Created
September 20, 2016 10:45
-
-
Save plu/44e2e37e662293be2f3d1a597d012751 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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