This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
struct Person { | |
var name: String = "John" | |
var age: Int = 50 | |
var dutch: Bool = false | |
var address: Address? = Address(street: "Market St.") | |
} | |
struct Address { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol NonemptyCollection: Collection { | |
var first: Iterator.Element { get } | |
} | |
enum NonemptyIndex<Base: Collection>: Comparable { | |
case head | |
case tail(Base.Index) | |
static func ==(lhs: NonemptyIndex, rhs: NonemptyIndex) -> Bool { | |
switch (lhs,rhs) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Credits to @gsampaio for coming up with the Effect<S, A> type. | |
* Even though this flavor of reducer also describes side-effects, | |
* testing is still trivial since it's sufficient to check if the | |
* side-effects are of the right type. The actual execution of the | |
* effect can be tested separately using integration tests. */ | |
import RxSwift | |
class Effect<S: Equatable, A: Action> { | |
open func execute(state: () -> S) -> Observable<A> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//===----------------------------------------------------------------------===// | |
// | |
// This source file is a modification of the PropertyListEncoder from the Swift project. | |
// The modification consists of skipping the final serialization into binary format (in the encode function) and instead returning the dictionary representation of the object to be encoded. | |
// | |
//===----------------------------------------------------------------------===// | |
import Foundation | |
//===----------------------------------------------------------------------===// |
OlderNewer