I have a MacOS app that displays a MapKit Map on the main scene. The user can drag the map around with the mouse and the motion is smooth, until I enable the Settings scene.
With the Settings scene enabled, the map doesn't follow the mouse but moves when the mouse is released.
If I replace the Settings scene with a "Hello, World" view, the map dragging is fine.
var body: some Scene {
WindowGroup {
LicenseLookupView(fccData: fccData)
.navigationTitle(title)
}
Settings {
FCCDatabaseSettings(fccData: fccData)
}
}
I put a print statement in the constructor to the Setttings scene and the program prints multiple times as the map is dragged, so it appears that even though the Settings scene is not displayed to the user, it is being recreated every time the main Scene is updated. Is there a way to keep that from happening and only build the Settings scene when it is going to be shown to the user?
As a comparison, the Preferences... dialog for Xcode is complex, yet it doesn't impact the performance of the app. Of course, Xcode may not be written in SwiftUI.
Thanks in advance, Mark