Previously I mentioned ReactiveCocoa a library adding reactive extensions to Objective-C based on the reactive programming paradigm similar to reactive extensions for .NET.
The guys at Github have released another open source library called ReactiveLayout that utilizes ReactiveCocoa providing an alternative to auto-layout that was added in iOS 6, and offering a number of potential advantages.
Here’s a list of ReactiveLayout advantages as stated in the readme:
– Explicit and linear layout. Reactive layout proceeds in a linear fashion, making it easier to understand and debug the steps it takes along the way.
– Top-down layout. A view’s layout doesn’t interact with its superview’s layout unless the former’s size or frame is explicitly incorporated in the latter’s layout chain, creating a unidirectional relationship that leads to better encapsulation (no global priorities!) and less complexity. Bidirectional relationships are still possible, but must be made explicit.
– Conditional layouts at runtime. RCL is built on the full power of ReactiveCocoa, and signals can be composed to dynamically disable and re-enable entire layout chains (like when you want to hide and show views) without actually modifying them.
– Implicit animations. To animate the setting of a view’s frame, simply add an animation method into the signal chain. No need to explicitly animate constants anywhere.
– Incremental use. RCL can be used internally in views without any implementation details leaking out. Callers using Auto Layout or struts and springs can incorporate reactive views without knowing or caring how they perform layout internally. No UI-wide slowdowns or behavior changes just from using RCL!
– Extensibility. RCL is made up of many independent bits of functionality unified into a framework. It’s easy to extend it with your own functionality if you want it to behave differently.
– Not a black box. Unlike AppKit and UIKit, RCL is an open source project, so you can crack open any particular bit and see why it behaves the way it does.
You can download ReactiveLayout along with a couple of examples on Github here.
While you might be perfectly satisfied with auto layout in the iOS 6 SDK it is very interesting to see how Github utilizes the ReactiveCocoa library in ReactiveLayout.
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.