Skip to content

Instantly share code, notes, and snippets.

@soapyigu
Created January 22, 2023 01:44
Show Gist options
  • Save soapyigu/a6c45416ff2497d8f61f9125450c1bb4 to your computer and use it in GitHub Desktop.
Save soapyigu/a6c45416ff2497d8f61f9125450c1bb4 to your computer and use it in GitHub Desktop.
class NotificationCenter {
static let shared = NotificationCenter()
// notification to (class name and closures)
private var notificationsStorage = [String: [(String: [(String, Any) -> Void)]]]()
private init() { }
func addObserver(_ class: Any?, name: String, closure: @escaping (String, Any) -> Void) { }
func removeObserver(_ class: Any?, name: String) { }
func postNotification(_ name: String, _ object: Any?) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment