Skip to content

Instantly share code, notes, and snippets.

@owenzhao
Created November 1, 2016 13:45
Show Gist options
  • Save owenzhao/c989324562964828cf007ec00389e7d1 to your computer and use it in GitHub Desktop.
Save owenzhao/c989324562964828cf007ec00389e7d1 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()
DispatchQueue.main.asyncAfter(wallDeadline: .now() + .milliseconds(100)) { [unowned self] () -> () in
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