I want to share one variable from my UIKit File to my Widget Extension created with SwiftUI. I followed this here. Please look at the answer from J Arango.
But i dont und
UserDefaults
in your main App:UserDefaults(suiteName: <your_app_group>)!.set("test", forKey: "test")
UserDefaults
in your Widget:let testStr = UserDefaults(suiteName: <your_app_group>)!.string(forKey: "test")
If you want to save other types see: