View expectable.swift
This file contains 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
extension CLLocation: Asking, Expectable { | |
static func ask<E>(with: Any?, in pipe: Pipe, expect: Expect<E>) { | |
let source = with as? CLLocationManager ?? pipe.get() | |
let handler = { (status: CLAuthorizationStatus) -> Bool in | |
guard status != .notDetermined else { | |
return true | |
} |
View pipe.progress.swift
This file contains 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
| .every { T in | |
} | .one { U in | |
} | .any { some in | |
} | .all { last in | |
} |
View pipe.chain.swift
This file contains 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
| .every { T in | |
} | .one { U in | |
} | .while { E in | |
true | |
} |
View asking.swift
This file contains 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
//Look to geolocation permissions request to illustrate. | |
//Request is constructed according to `with` object | |
// | |
//Ask always permissions only if `ask` `with` `CLAuthorizationStatus.authorizedAlways` input argument | |
//Otherwise `ask` only in use permissions | |
// | |
extension CLAuthorizationStatus: Asking { | |
static func ask<E>(with: Any?, in pipe: Pipe, expect: Expect<E>) { | |
let source = with as? CLLocationManager ?? pipe.get() |
View pipe.sugar.swift
This file contains 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
|.every { T in | |
} | |
|.one { T in | |
} | |
|.while { T in | |
true |
View pipe.expect.swift
This file contains 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
Expect.every { T in | |
} | |
Expect.while { T in | |
true | |
} | |
let expect = Expect.one { T in |
View pipe.under.swift
This file contains 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
//Put any | |
func put<T>(_ object: T) -> T | |
//Get any | |
func get<T>() -> T? |
View pipe.sync.examples.swift
This file contains 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
//Anything from Something | |
let anything: Anything = something| | |
let i: Int = float| | |
let string: String = data| | |
let front: UIColor = 0x554292| | |
let back: UIColor? = "#554292"| |
View customize.swift
This file contains 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
//Recognize 4 hands on input | |
let pipe = |{ (hands: [VNHumanHandPoseObservation]) in | |
} | |
let request: VNDetectHumanHandPoseRequest = pipe.get() | |
request.maximumHandCount = 4 | |
let preview: AVCaptureVideoPreviewLayer? = pipe.get() | |
view.layer.addSublayer(preview!) |
NewerOlder