Last active
January 30, 2017 17:19
-
-
Save roymckenzie/dd56a2bee59de19897d7eff24a5e5e46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
final class DataDisplayViewController: UIViewController { | |
private var realmNotificationToken: NotificationToken? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
startRealmNotification() | |
} | |
private func startRealmNotification() { | |
do { | |
let realm = try Realm() | |
realmNotificationToken = realm.addNotificationBlock() { [weak self] _, _ in | |
// TODO:- UPDATE UI | |
} | |
} catch { | |
print("Error setting up Realm Notification: \(error.localizedDescription)") | |
} | |
} | |
deinit { | |
realmNotificationToken?.stop() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment