in SceneDelegate

let rootView = MainView()
            .environmentObject(mySchedule)
            .environmentObject(MapItemModel())

if let windowScene = scene as? UIWindowScene {
       let window = UIWindow(windowScene: windowScene)
       window.rootViewController = UIHostingController(rootView: rootView)
       self.window = window
       window.makeKeyAndVisible()