NotificationCenter.swift 828 B

1234567891011121314151617181920
  1. import Foundation
  2. protocol NotificationCenter {
  3. func addObserver(_ observer: Any, selector aSelector: Selector, name aName: NSNotification.Name?, object anObject: Any?)
  4. func post(_ notification: Notification)
  5. func post(name aName: NSNotification.Name, object anObject: Any?)
  6. func post(name aName: NSNotification.Name, object anObject: Any?, userInfo aUserInfo: [AnyHashable: Any]?)
  7. func removeObserver(_ observer: Any)
  8. func removeObserver(_ observer: Any, name aName: NSNotification.Name?, object anObject: Any?)
  9. @discardableResult func addObserver(
  10. forName name: NSNotification.Name?,
  11. object obj: Any?,
  12. queue: OperationQueue?,
  13. using block: @escaping (Notification) -> Void
  14. ) -> NSObjectProtocol
  15. }
  16. extension Foundation.NotificationCenter: NotificationCenter {}