This is a bit of a weird one, but I’m having an issue where when I run my SwiftUI app on Mac to test (pressing command + r pr pressing the play button, previews work fine), it opens a blank window without any content in it. If I open a new window by pressing command + n, the actual window of the app shows up. What’s weirder is that this only happens on one Mac; I’ve tried it on another one with the same Xcode project, same code, same OS version, same Xcode version, etc, and the issue doesn’t occur; the app opens the normal window as expected. It also doesn’t happen on iOS and iPadOS, both on devices or in the simulator.
I’m thinking it might be some cache files that messed something up and are preventing the right window from loading, but unlike the iOS simulator, I can’t delete the app and rerun to “reinstall.” Does anyone know how to do this?
Any help would be greatly appreciated. Super annoying and certainly not shippable; I don’t want to use up one of my TSIs to figure it out since nobody else on the entire internet has had this issue. Maybe it’s just a SwiftUI bug? I don’t know! I’ve attached some code below and a screen shot of the issue. Thanks!
// Main app file
@main
struct CitationsApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
// ContentView
struct ContentView: View {
@State private var isShowingMLAView = true
var body: some View {
NavigationView {
List {
NavigationLink(destination: MLA().navigationTitle("Create Citation"), isActive: $isShowingMLAView) {
Label("MLA", systemImage: "doc.text")}
}
.listStyle(.sidebar)
.navigationTitle("Citations")
}
}
}