diff --git a/Sources/Then/Then.swift b/Sources/Then/Then.swift index 2be8422..39663a6 100644 --- a/Sources/Then/Then.swift +++ b/Sources/Then/Then.swift @@ -71,6 +71,23 @@ extension Then where Self: AnyObject { } +extension Then where Self: NSObject { + + + /// Makes it available to set properties with closures just after initializing. + /// + /// let label = UILabel { + /// $0.textAlignment = .Center + /// $0.textColor = UIColor.blackColor() + /// $0.text = "Hello, World!" + /// } + init(block: (Self) -> Void) { + self.init() + block(self) + } + +} + extension NSObject: Then {} extension CGPoint: Then {}