Skip to content

Instantly share code, notes, and snippets.

@daehn
Created June 26, 2019 10:00
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 daehn/ee39b6c487496bbc4e2f6a7322e4cf78 to your computer and use it in GitHub Desktop.
Save daehn/ee39b6c487496bbc4e2f6a7322e4cf78 to your computer and use it in GitHub Desktop.
final class OnceToken {
private(set) lazy var perform: () -> Void = {
self.closure()
return {}
}()
private let closure: () -> Void
init(execute closure: @escaping () -> Void) {
self.closure = closure
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment