iOS Initialize with then


This is similar in syntax to the example that initializes using positional constants, but requires the Then extension from (attached below).

let label = UILabel().then {
    $0.textAlignment = .Center
    $0.textColor = UIColor.blackColor(
    $0.text = "Hello, World!"

The Then extension:

import Foundation

public protocol Then {}

extension Then 
    public func then(@noescape block: inout Self -> Void) -> Self {
        var copy = self
        return copy

extension NSObject: Then {}