Then

public protocol Then

Undocumented

Available where Self: Any

  • with(_:) Extension method

    Makes it available to set properties with closures just after initializing and copying the value types.

    let frame = CGRect().with {
      $0.origin.x = 10
      $0.size.width = 100
    }
    

    Declaration

    Swift

    public func with(_ block: (inout Self) throws -> Void) rethrows -> Self
  • do(_:) Extension method

    Makes it available to execute something with closures.

    UserDefaults.standard.do {
      $0.set("devxoul", forKey: "username")
      $0.set("devxoul@gmail.com", forKey: "email")
      $0.synchronize()
    }
    

    Declaration

    Swift

    public func `do`(_ block: (Self) throws -> Void) rethrows

Available where Self: AnyObject

  • then(_:) Extension method

    Makes it available to set properties with closures just after initializing.

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

    Declaration

    Swift

    public func then(_ block: (Self) throws -> Void) rethrows -> Self