Hi, I need to access my core data class from a widget. To then use it for calculating when the widget needs to update, and with what data.
I have defined my widget in the main and then its in an Environment, so that I can access it in all the other views:
@main
struct main_appApp: App {
@StateObject var vm = CoreDataViewModel()
var body: some Scene {
WindowGroup {
Widget_Resa().environmentObject(vm)
}
}
}