我需要在我的项目中添加观察,但是由于与我一起工作的经理不允许我在函数中使用@objc,无论如何我可以在不使用@objc的情况下使用这个函数吗?
func createObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(self.updatedata(notification:)),
name: Notification.Name(rawValue: updateNotificationKey), object: nil)
}
@objc dynamic func updatedata(notification: NSNotification) {
updateDataIcon()
}
Run Code Online (Sandbox Code Playgroud)
我们将不胜感激您的帮助。