Skip to content

Instantly share code, notes, and snippets.

@erica
Created May 25, 2016 17:16
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save erica/72be2ffe76a569376469c2f2110aee9c to your computer and use it in GitHub Desktop.
Save erica/72be2ffe76a569376469c2f2110aee9c to your computer and use it in GitHub Desktop.
// @discardableResult to be added
// @noescape needs to move to type annotation
// needs to add _ for item
public func with<T>(item: T, @noescape update: (inout T) throws -> Void) rethrows -> T {
var this = item; try update(&this); return this
}
@catalandres
Copy link

Did this end up submitted as a Swift Evolution proposal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment