The Elm Architecture in Swift
This project is a port of The Elm Architecture to Swift.
This is sample code, and not at all production-ready. It's a proof-of-concept, it seems to work well and I don't think there are major roadblocks (except adding all of UIKit to the virtual views layer).
Open the workspace, and look at the playgrounds. It shows some examples. (Even though the playgrounds currently don't seem to run).
Then go to AppDelegate, and run one of the three apps (uncomment the right lines to run one of them).
This is part of an upcoming project I'm working on, and I am planning to write up documentation for usage and implementation (at some point).
There are three sample apps:
For more Elm-like frameworks in Swift, see Yasuhiro Inami's excellent list.
Enjoy!
Notes:
- If you come from a functional language such as Elm or Haskell, you might be put off by the fact that
send
is marked asmutating
. Don't be fooled: it behaves very similar to Elm/Haskell. You still have value semantics, and you can still have a time-traveling debugger. See structs and mutation or undo history for some more info on that.