how to use notification to communicate among controllers

  1. code the notification name

extension Notification.Name {

    static let exampleName = Notification.Name(“com.example.exampleName”)

}

2. add Observer on the controller that receive the notification. You do not need to removeObserver when deallocating since iOS 9

NotificationCenter.default.addObserver(self, selector: #selector(didExample), name: NSNotification.Name.exampleName, object: nil)