Created
June 13, 2018 21:25
-
-
Save suatkarakusoglu/3f387c1120ebf5a3c36a01466928aa79 to your computer and use it in GitHub Desktop.
ZMLocalBroadcastSampleVC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ZMLocalBroadcastSampleVC: UIViewController { | |
var observerMagicHappened: ZMLocalBroadcastObserver? | |
override func viewDidLoad() | |
{ | |
super.viewDidLoad() | |
self.observerMagicHappened = ZMLocalBroadcastType.someMagicHappened.observeBroadcast {[weak self] (data) in | |
guard let sSelf = self else { return } | |
if let magicName = data?["magicName"] as? String | |
{ | |
print("\(magicName) is magic") | |
} | |
} | |
} | |
deinit | |
{ | |
self.observerMagicHappened?.stopObserving() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment