Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvingit/23ed08e4fdc32e37fb5016aa473fc025 to your computer and use it in GitHub Desktop.
Save calvingit/23ed08e4fdc32e37fb5016aa473fc025 to your computer and use it in GitHub Desktop.
/// 简化多次赋值的变量初始化
public protocol Then {}
extension Then {
@discardableResult
@inlinable
public func `do`(_ block: (Self) throws -> Void) rethrows -> Self {
try block(self)
return self
}
}
extension NSObject: Then {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment