Built-in NotificationCenter
API to broadcast
notifications whenever the press
method is called.
let nofitication = NotificationCenter.default
nofitication.post(name: Notification.Name("pressMethodCalled"), object: nil)
Register the notification:
nofitication.addObserver(self, selector: #selector(your_method_name), name: Notification.Name("pressMethodCalled"), object: nil)
- Delegates: One to One. Read more here - https://medium.com/@jamesrochabrun/implementing-delegates-in-swift-step-by-step-d3211cbac3ef