When I set up notification in Swift 3, I can declare the selector with or without the class prefix. In both cases, the method is an instance method. What's the difference between prefixing the class vs not? What if the selector should be pointing a class method instead?
class Test : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self,
selector: #selector(fresh), name: .refresh, object: nil)
}
func refresh() {
}
}
vs
class Test : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self,
selector: #selector(Test.fresh), name: .refresh, object: nil)
}
func refresh() {
}
}