There's an interesting iOS Swift tutorial on wiring up your UI code with reactive binding from Colin Eberhardt over at RayWenderlich. The "Bond Tutorial: Bindings in Swift" shows a fluent and expressive way to manipulate how data flows through your app, using the Swift Bond library.
Swift Bond is a binding framework that removes the mundane task of wiring up your UI, giving you more time to think about the real problems you are trying to solve with your application.
However, its awesome creator Srđan Rašić now focuses more on his new and improved framework for reactive and functional reactive programming: ReactiveKit. To get a feel for the the changes, I recreated the demo app from the tutorial, swapping out Bond in favor of ReactiveKit (The diff).
See my article which includes a nice GIF.
First, clone the project:
% git clone https://github.com/sohooo/BindingWithReactiveKit.git
Then install the pods:
% cd BindingWithReactiveKit/
sohooo@aiur [~/Code/swift/BindingWithReactiveKit (master)]
% pod install
Analyzing dependencies
Downloading dependencies
Installing DatePickerCell (1.0.4)
Installing ReactiveFoundation (1.0.4)
Installing ReactiveKit (1.1.3)
Installing ReactiveUIKit (1.0.10)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 4 total pods installed.
% open BindingWithBond.xcworkspace
Finally, open the project and add your 500px API key in Info.plist
(look for apiKey: Your key goes here
), as described in the tutorial in "Using the 500px API". Create an account if you need, it's free.
Enjoy!
- "Bond Tutorial: Bindings in Swift"
- This Github repository
- Framework: Swift Bond
- Framework: ReactiveKit