Notification+Extension.swift 835 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // Notification+Extension.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2018/4/18.
  6. // Copyright © 2018年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. enum OONotification:String {
  10. //登录相关
  11. case login
  12. case logout
  13. case bindCompleted
  14. // 考勤管理相关
  15. case location
  16. case newWorkPlace
  17. case staticsTotal
  18. //重载门户webview
  19. case reloadPortal
  20. case websocket
  21. var stringValue:String {
  22. return "OOK" + rawValue
  23. }
  24. var notificationName:Notification.Name {
  25. return Notification.Name(stringValue)
  26. }
  27. }
  28. extension NotificationCenter {
  29. static func post(customeNotification name: OONotification, object: Any? = nil) {
  30. NotificationCenter.default.post(name: name.notificationName, object: object)
  31. }
  32. }