A swift playground experiment in making a Swift struct to JSON serialization.
The approach currently fails for arrays, but those can be handled much like dictionaries and optionals.
# [Bret Victor](http://worrydream.com/) | |
* [Inventing on Principle](http://www.youtube.com/watch?v=PUv66718DII) | |
* [The Future of Programming](http://vimeo.com/71278954) | |
* [Stop Drawing Dead Fish](http://vimeo.com/64895205) | |
# Doug Engelbart | |
* [The Mother of All Demos](http://www.youtube.com/watch?v=yJDv-zdhzMY) - 1968 Ridiculousness |
// | |
// AVAsset+Catalog.swift | |
// Micro Album | |
// | |
// Created by Fabian Canas on 5/28/19. | |
// Copyright © 2019 Fabian Canas. All rights reserved. | |
// | |
import AVFoundation | |
import MobileCoreServices |
A swift playground experiment in making a Swift struct to JSON serialization.
The approach currently fails for arrays, but those can be handled much like dictionaries and optionals.
import UIKit | |
/*: | |
# Ordering Matters in UIFontDescriptor | |
Oct 21, 2017, iOS 11 | |
When creating a derived font descriptor with a font family, existing traits | |
such as italic or bold are overwritten or ignored. | |
*/ |
import Foundation | |
class C { | |
@NSCopying var copiedName: NSString? | |
var noCopyName: NSString? | |
} | |
let f = NSMutableString(string: "First") | |
let obj = C() |
class C<T> { | |
enum E { | |
case c(T) | |
} | |
var e: E? | |
} | |
let o = C<Int>() // Crash : cyclic metadata dependency detected, aborting |
extension Sequence where Element: BinaryFloatingPoint { | |
func average() -> Element { | |
return abstractAverage(sequence: self, sum: +, div: /) | |
} | |
} | |
extension Sequence where Element: SignedInteger { | |
func average() -> Element { | |
return abstractAverage(sequence: self, sum: +, div: /) | |
} | |
} |
public struct Distance :NumericType { | |
public var value :Double | |
public init(_ value: Double) { | |
self.value = value | |
} | |
} | |
extension Distance :IntegerLiteralConvertible { | |
public init(integerLiteral: IntegerLiteralType) { | |
self.init(Double(integerLiteral)) |
Here's a lesson I learned testing UI components in Cocoa Touch on FCSettingsBooster.
Let's say you have some UISwitch element that you wire up programmatically:
[_theSwitch addTarget:self action:@selector(setDefaults) forControlEvents:UIControlEventValueChanged];
And you're going to try and make sure that some eventual effect is triggered by chaning the UISwitch. The fact that the setDefaults selector is called is irrelevant. In this case, we want to ensure that a completion block is called. You might think you can test it as follows: