This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.
- ReactSwift by @ColinEberhardt
- https://github.com/ColinEberhardt/ReactSwift
typealias Completion<Value, Error: Swift.Error> = (Result<Value, Error>) -> Void | |
typealias TaskHandler<Value, Error: Swift.Error> = (@escaping Completion<Value, Error>) -> Void | |
struct Task<Value, Error: Swift.Error> { | |
private let handler: TaskHandler<Value, Error> | |
init(_ handler: @escaping TaskHandler<Value, Error>) { | |
self.handler = handler | |
} |
enum SingleOrMultiple<Value> { | |
case single(Value) | |
case multiple([Value]) | |
func map<T>(_ transform: (Value) throws -> T) rethrows -> SingleOrMultiple<T> { | |
switch self { | |
case let .single(value): return .single(try transform(value)) | |
case let .multiple(values): return .multiple(try values.map(transform)) | |
} | |
} |
func printFunc(str: String) { | |
print(str) | |
} | |
// Int2つを、引数として宣言 | |
func someFunc(a: Int, b: Int) -> String { | |
return "a: \(a), b: \(b)" | |
} | |
// Int2つを持つタプルを、引数として宣言 |
This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.