Latest 0.1.4
License MIT
Platforms ios 8.0
Dependencies AlamofireImage


UIBinder help you map object to view so you don’t need any more to write

label.text =
textView.text = object.description
textField.text = object.age

UIBinder do all that for you.


To run the example project, clone the repo, and run pod install from the Example directory first.


See the code snippet below for an example of how to implement, or see the example project.


self.view.bindSubviewsWith( object)

where object is either NSObject or dictionary with the required values to update current view with

In StoryBoard you need to set for the desired view param where
in case object passed in bindSubviewsWith is dictionary then param is the key ,
in case that object is NSObject then param is the property name

and that’s it when you will run your code you will find the view get updated with right value from object you have passed to it

In case you want to update certain view you can use



you can bind each object in array for the right cell using



first let’s talk about what you need to set in storyboard


it support being String or UIImage
in case of UIImage it will be set to ImageView
if string the that’s mean it’s url so UIBinder will try to download this image for you


represent the image that will be set until image is loaded


represent the image that will be set if couldn’t get image set in param


in case you know url that has the image you need you can pass it to completeUrl

Download Method

now after you pass the value of url to image either by using completeUrl or param
it’s time to download it


UIBinder rely on AlamofireImage in downloading image so if you provide imageView with url that has image directly
UIBinder will download it for you .

Custom Download

incase you need to customize anything in the download process you can impolement
and override

  func downloadImageWith(url: String, onSucces completion: @escaping ((UIImage) -> ()), onError errorCompletion: @escaping     (UIImage, Error) -> ())
  • url : is url that is passed in to imageview in param or completeUrl .
  • onsuccess : you will return image to be set to imageView .
  • onError : you will pass image to be set to imageView and Error to be passed to ImageDownloadListener .

this is protocol you need to implement in case you need to know when image is downoloaded or failed to be downloaded
by implementing

   func imageDidDownload(downloadedImage : UIImage)
   func imageFailedToDownloadWith(error : Error)
How to set ImageDownloadListener and ImageDownloadDelegate to imageView

1- done seperatly to each UIViewController

  • in storyBoard you connect them using outlets in UIImageView
  • in viewController class
      self.imageView.downloadDelegate = CustomDownloadDelegate()
      self.imageView.downloadListener = CustomDownloadListener()

2 – done for every image in your app
in app delegate

  ImageManager.sharedManager.imageDownloadDelegate = CustomImageDownloader()
  ImageManager.sharedManager.imageDownloadListener = CustomImageDownloader()

Image Caching

UIBInder use AlamofireImage ImageCaching

Supperted UIViews till now

  • UILabel
  • UITextView
  • UITextField
  • UIImageView

for other unsupported UIViews or custom View you can do it like that

extension UITextView{

    override public func bindTo(_ object : NSObject){
    // if object is dictionary then you will use  
        if let dic = object as? NSDictionary {
            self.text = self.getStringValueFromDictionary(dic: dic)
        // else first check if param has value not nil then get string represtation of this value
        if  let param : String =   self.param {
            if let value = object.getPropertyValueWith(label :param) {
                if let v = value   as? String {
                    self.text = v
                }else if let text =  object.getPropertyValueWith(label :param) {
                    self.text = String(describing: text)





UIBinder is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "UIBinder"


MohamedMatloub, [email protected]


UIBinder is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "UIBinder",
    "version": "0.1.4",
    "summary": "UIBinder is library that can help in binding object to view dynamically.",
    "description": "UIBinder is library that can help in binding object to view dynamically.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "MohamedMatloub": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.4"
    "platforms": {
        "ios": "8.0"
    "source_files": "UIBinder/Classes/**/*",
    "dependencies": {
        "AlamofireImage": [
            "~> 3.1"
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This