Skip to content

Instantly share code, notes, and snippets.

@robertmryan
Created October 20, 2016 04:29
Show Gist options
  • Save robertmryan/b7217bc9c6e296e55b6ff46de240cdd5 to your computer and use it in GitHub Desktop.
Save robertmryan/b7217bc9c6e296e55b6ff46de240cdd5 to your computer and use it in GitHub Desktop.
import UIKit
import os.log
// This reported:
//
// 2016-10-19 21:27:58.383124 MyApp[6452:1422313] about to set to `nil`
// 2016-10-19 21:27:58.383439 MyApp[6452:1422313] set to nil
// 2016-10-19 21:27:58.383711 MyApp[6452:1422313] finished setting to `nil`
class ViewController: UIViewController {
var foo: Foo? = Foo()
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
os_log("about to set to `nil`")
self.foo = nil
os_log("finished setting to `nil`")
}
}
}
class Foo {
deinit {
os_log("set to nil")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment