Skip to content

Instantly share code, notes, and snippets.

@owenzhao
Created November 1, 2016 13:38
Show Gist options
  • Save owenzhao/e35d56be8f52a7ef0c74b6ad21ceac87 to your computer and use it in GitHub Desktop.
Save owenzhao/e35d56be8f52a7ef0c74b6ad21ceac87 to your computer and use it in GitHub Desktop.
use delay to run away from UserDefaults' bug
class TableViewController: NSViewController, NSTableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
run()
Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(sendNotification), userInfo: nil, repeats: false)
}
func sendNotification() {
NotificationCenter.default.post(name: TableViewControllerDidAppear, object: self)
}
func run() {
// do things
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment