Skip to content

Project provides basic idea and approach to implement the NotificationCenter by using Pubs/Subs Pattern, and Observer design pattern, this pattern oppose to create strong reference cycle because of weak reference of protocol.

License

Notifications You must be signed in to change notification settings

email2sunilverma/SNotificationCenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SNotificationCenter

Project provides basic idea and approach to implement the NotificationCenter by using Pubs/Subs Pattern, and Observer design pattern, this pattern oppose to create strong reference cycle because of weak reference of protocol.

HOW TO Use

  • Drag and drop the file SNotificationManager in your project
  • Susbscribe the Observer By: SNotificationManager.addObserver(observer: self, type: .jwtTokenExpired, selector: #selector(tokenExpired(noti:)))
  • Publish the Observer By: SNotificationManager.postObserver(type: .jwtTokenExpired, object: true)
  • Receive the Observers By: ' @objc fileprivate func tokenExpired(noti: NSNotification) { if let expired = noti.object as? Bool { print(" expired: (expired)") } }'

Observer Design Paterns

  • Add Observers By: SObserverManager.shared.addObserver(observer: self)

  • Connfirm the protocol By: ' extension ViewController :SObserver { func notifyUpdate() { print("Observers notified") }
    }'

  • Remove Observer By: ' deinit { SObserverManager.shared.removeObserver(observer: self) }'

Author

License

SNotificationCenter is available under the MIT license. See the LICENSE file for more info.

Other Libraries

  • SPopupMenu:- Simple UI for create the POP list for menu with Text, Text With Icon, Muliti Seelction.

About

Project provides basic idea and approach to implement the NotificationCenter by using Pubs/Subs Pattern, and Observer design pattern, this pattern oppose to create strong reference cycle because of weak reference of protocol.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages