Example: Applying The Backbone.js View Concepts To An iOS UIView With Objective-C

Earlier this month I mentioned an interesting Objective-C library inspired by the Underscore.js library called Underscore.m.

Here’s a source code example for managing  UIViews inspired by the patterns used in BackBone.js  of observing changes to the data model and modifying the user interface based on those changes within the model.

The rules followed by NSBackbone for modifying views according to it’s creator are:

1. A view renders the UI when it loads.
2. A view observes changes to the model’s data and re-render the UI.
3. User actions change the model’s data and not the UI. The UI will be updated by observing the model’s changes.

This Gist demonstrates usage of NSBackbone:

You can find NSBackbone on Github here.

You can read more about the example and benefits of this pattern on Berniz’s blog here.

An interesting alternative to the usual way of working with UIViews.

DeliciousTwitterFacebookRedditLinkedInEmail

Original article: Example: Applying The Backbone.js View Concepts To An iOS UIView With Objective-C

©2012 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *