Are the new notifications not currently working in Swift 3?
I am doing:
NotificationCenter.default().post(name: DidTouchParticleView, object: self.particle as? AnyObject)
In a custom view's touchesBegan()
and I need to send the particle
object to the view controller if there is one. So I do this:
NotificationCenter.default().addObserver(forName: DidTouchParticleView,
object: self,
queue: OperationQueue.main(),
using: presentParticleDisplayView(notification:))
In a view controller's viewDidLoad()
. I am certain that that particular view controller is the one presented when I tap my custom view, however, the function presentParticleDisplayView(notification:)
is never called.
Also, DidTouchParticleView
is defined globally like this:
let DidTouchParticleView = NSNotification.Name("didTouchParticleView")
Is this due to the beta, or am I doing something wrong?
default()
are removed; it isNotificationCenter.default
. – Rummer