Hi, I was wondering if it was possible to get a notification when there is a change to the forced defaults that my app uses. This forced defaults are sent via MDM using the com.apple.ManagedClient.preferences
payload type. I've seen that UserDefaults.didChangeNotification
is available but it only works if the change is made from inside the app and not if the payload gets updated by the MDM.
class MySettings {
private let defaults = UserDefaults(suiteName: "com.myapp.app.mysettings")
init() {
// Somehow register for notifications
}
func defaultsChanged() {
// This would be called when the defaults change
}
}