Skip to content

Instantly share code, notes, and snippets.

@plu
Created September 20, 2016 10:45
Show Gist options
  • Select an option

  • Save plu/44e2e37e662293be2f3d1a597d012751 to your computer and use it in GitHub Desktop.

Select an option

Save plu/44e2e37e662293be2f3d1a597d012751 to your computer and use it in GitHub Desktop.
import Foundation
class Foo {
let completionHandler: ([String]) -> Void
init(completionHandler: @escaping ([String]) -> Void) {
self.completionHandler = completionHandler
}
}
class Bar {
var foo: Foo?
var result: [String] = []
deinit {
print("deinit: \(self)")
}
func perform() {
foo = Foo(completionHandler: { (result: [String]) in
self.result = result
})
}
}
var bar: Bar? = Bar()
bar?.perform()
bar = nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment