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
func weaklyScoped<T: AnyObject>(_ v: @autoclosure () -> T, action: (T) throws -> ()) rethrows -> T? { | |
weak var weakValue: T? | |
do { // optionally autoreleasepool | |
let value = v() | |
try action(value) | |
weakValue = value | |
} | |
return weakValue | |
} |
/// Withable is a simple protocol to make constructing | |
/// and modifying objects with multiple properties | |
/// more pleasant (functional, chainable, point-free) | |
public protocol Withable { | |
init() | |
} | |
public extension Withable { | |
/// Construct a new instance, setting an arbitrary subset of properties | |
init(with config: (inout Self) -> Void) { |
import Foundation | |
import PlaygroundSupport | |
enum URLResult { | |
case response(Data, URLResponse) | |
case error(Error, Data?, URLResponse?) | |
} | |
extension URLSession { | |
@discardableResult |
This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.
import Foundation | |
struct Country { | |
let name: String | |
let capital: String | |
var visited: Bool | |
} | |
extension Country: Equatable { | |
static func == (lhs: Country, rhs: Country) -> Bool { |
VICE is the best by such a commanding margin that you really needn't look elsewhere. Open source and has the largest community.
However, other options are:
Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.
addReducers()
callback available to the getComponents()
method of
each React Router route. Each route is responsible for adding any Redux
reducers it needs when it's loaded. (This isn't really necessary on theimport Cocoa | |
enum CoroutineState { | |
case Fresh, Running, Blocked, Canceled, Done | |
} | |
struct CoroutineCancellation: ErrorType {} | |
class CoroutineImpl<InputType, YieldType> { | |
let body: (yield: YieldType throws -> InputType) throws -> Void |
/* | |
a shader executes per pixel | |
so every thing you see here is he function for every pixel | |
raymarching is in principe a function that finds the closest point to any surface in the world | |
then we move our point by that distance and use the same function, | |
the function will probably be closer to an object in the world every time | |
and after about 40 to 200 iterations you'll either have found an object or | |
missed them all into infinity |
license: gpl-3.0 | |
redirect: https://observablehq.com/@d3/draw-me |