This is a Swift framework providing a number of functions and types that I miss in Swift standard library.
Signal<A>
The Signal is a stream of values over time
Property<A>
and MutableProperty<A>
The Property is a value + signal with changes
Promise<A>
The Promise is an async version of Result. Promises can be used instead of completion handlers to avoid nested closures.
Monoid
Any type that has empty value and can be comined.
§
— Function application ⌥+6
•
— Function composition ⌥+8
∑
— Prefix sum operator ⌥+W
id
Identity function same as { $0 }
const
A constant function. Takes a value and returns a function that returns that value no matter what it is fed.
weakify
let f = weakify(self) { $0.handleEvent }
equals to
let f = { [weak self] in
guard let self = self else { return }
self.handleEvent($0)
}
curry
Currying takes a function of >1 parameter and returns a function of one parameter which returns a function of one parameter, and so on. That is, given (A, B) -> C
, currying returns A -> B -> C
.
⛔️ Carthage support is deprecated starting v3.0.0. Install using Swift Package Manager
link |
Stars: 11 |
Last commit: 4 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics