Watch iCloud for changes in the destination list.

This commit is contained in:
Jeremy Rand 2021-11-03 23:30:49 -04:00
parent dffbd0ec1c
commit 0138a4de79
2 changed files with 12 additions and 3 deletions

View File

@ -61,11 +61,20 @@ class GSDestinations : ObservableObject {
private func saveDestinations() {
NSUbiquitousKeyValueStore.default.set(storedDestinations, forKey: GSDestinations.kDestinationKey)
NSUbiquitousKeyValueStore.default.synchronize()
}
@objc func onUbiquitousKeyValueStoreDidChangeExternally(notification:Notification)
{
loadDestinations()
}
init() {
loadDestinations()
// JSR_TODO - Add code here to watch for changes from iCloud
NotificationCenter.default.addObserver(self, selector: #selector(onUbiquitousKeyValueStoreDidChangeExternally(notification:)), name: NSUbiquitousKeyValueStore.didChangeExternallyNotification, object: NSUbiquitousKeyValueStore.default)
}
deinit {
NotificationCenter.default.removeObserver(self)
}
}

View File

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>246</string>
<string>249</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSRequiresIPhoneOS</key>