I am trying to recreate the following example. However, when i create a Singleton class MyModel and bind the familyActivityPicker like this
@ObservedObject var model = MyModel.shared
....
....
Button("Present FamilyActivityPicker") { isPresented = true }
.familyActivityPicker(isPresented: $isPresented, selection: $model.discouragedApps)
Then in my DeviceActivityExtension I try to access the discouraged applications, this way
let model = MyModel()
let applications = model.discouragedApps
But the model.discouragedApps is always empty. How do I pass the selected applications into my extension. In all of the documentation this part is very conveniently left unexplained.
Can I use the local storage to save the user selection and then read it from there instead of having to use the Singleton pattern ?