I am building a workout app for Apple Watch with watchOS 5.
I am storing workout settings in UserDefaults plist. When the watch extension is launched I try to read the UserDefaults and have the workout settings restored for the user.
According to Apple Documentation
Additionally, iOS automatically forwards a read-only copy of your iOS app’s preferences to Apple Watch. Your WatchKit extension can read those preferences using an NSUserDefaults object, but it cannot make changes directly to the defaults database.
If your Watch app needs to change the values stored in the defaults database, use the Watch Connectivity framework to send the values back to your iOS app, and save the values there.
Since UserDefaults is just read only for watch Extension, If user changes any setting on the watch, I send that settings to iPhone with WatchConnectivity and store it into UserDefaults on iPhone. So the next time user launches watch Extension he should get updated userDefaults.
Now the problem is watch App also has a complication, If an Apple Watch App has complication it stays in the background in order to launch the app quickly. So when will the iOS app sync the read only copy of userDefaults?
What can be the best practice to follow if a user wants to restore its settings every time the watch app extension is launched?