Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

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.

Comments