天天看點

swift ReactiveSwift架構下通知(NotificationCenter)的使用

實作:

NotificationCenter.default.post(name: Notification.Name(rawValue: "NotificationName"), object: object)
           

注冊:

NotificationCenter.default.reactive.notifications(forName: Notification.Name(rawValue: "NotificationName")).observeValues {  [unowned self] object in
//實作
        }