Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source Swift Library Providing Easy To Use Swift Binding

  •  
  •  
  •  
  •  
  •  

Some time ago I mentioned the objective-c ReactiveCocoa library which at it’s core uses signals to allow you to bind multiple elements together to automatically watch for value changes.

Here’s an open source library called Bond from Srdan Rasic that adds a new operator to Swift that makes binding dead simple.

This example from the readme shows to bind the state of a text field to a label with Bond you could simply use:

textField ~> label

And this more complex example shows how one could dynamically update a table view with a repository data source object:

repositories.map { [unowned self] (repository: Repository) -> RepositoryTableViewCell in
      let cell = self.tableView.dequeueReusableCellWithIdentifier("cell") as RepositoryTableViewCell
      repository.name ~> cell.nameLabel
      repository.photo ~> cell.avatarImageView
      return cell
    } ~> self.tableView

Included within Bond are many helpers specifically for working with UIKit, arrays, KVO, and more with a number of code snippets in the readme, and a nice example showing how to dynamically update a table view with updated data.

You can find Bond on Github here.

A nice and simple bindings framework for Swift.


  •  
  •  
  •  
  •  
  •  

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