spilt cocoa

UIView+AddSubviews

extension UIView {  
        func addSubviews(views: UIView...) {
            for view in views {
                addSubview(view)
            }
        }
    }
    
    // Replace this
    addSubivew(viewA)  
    addSubview(viewB)
    
    // To this
    addSubviews(viewA, viewB)  
    
Continue reading...

Convenience method for building UIViews

func buildView<T: UIView>(closure: ((T) -> ())? = nil) -> T {  
      let view = T(frame: CGRectZero)
      view.setTranslatesAutoresizingMaskIntoConstraints(false)
      closure?(view)
    
      return view
    }
    
    
    // example
    let toggleWrapper: UIView = buildView { view in  
      view.backgroundColor = UIColor.n7Color()
    }
    
    lazy var customLabel: UILabel = buildView
Continue reading...

This is it

println("hello world")  
    
Continue reading...