Post

Replies

Boosts

Views

Activity

Reply to Sharing UserDefaults with widgets in iOS 14
I am having the same problem and am unable to pass UserDefaults with the same registered suite name from my main app to my iOS 14 Widget Extension. The UserDefaults (with the same suite name) are working properly in my main Objective C app, but are returning nil in the SwiftUI Widget extension. The UserDefaults AppGroups are included in both targets. I am new to SwiftUI and have probably done something wrong, but I have no clue what the issue may be. Does anyone have any suggestions?
Aug ’20
Reply to WidgetKit app in Obj C Project
I also have an Objective C main app and have implemented a SwiftUI widget extension which seems to work fine (I am using UserDefaults to send initial data to the widget, and that is working). However, I would like to update the widget from my main app and am having difficulty accessing WidgetCenter from it to do the update. I am not clear how to add the Swift code into my Objective C main app to do it. I tried the steps outlined in the previous reply without success, so I must be doing something wrong. Any suggestions?
Aug ’20