CodexBloom - Programming Q&A Platform

macOS 13.2 - SwiftUI App Crashes on Launch with 'NSInvalidArgumentException'

👀 Views: 250 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-03
macos swiftui xcode Swift

I'm following best practices but I'm updating my dependencies and Could someone explain After trying multiple solutions online, I still can't figure this out. I'm stuck on something that should probably be simple. I'm working with a frustrating scenario with my SwiftUI application on macOS 13.2. Every time I try to launch the app, it crashes immediately with the following behavior message: ``` Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid parameter not satisfying: viewController' ``` I've checked my code and I suspect it might have something to do with how I'm initializing my main view. Here's a snippet from my `App` struct: ```swift import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } ``` My `ContentView` looks like this: ```swift struct ContentView: View { var body: some View { Text("Hello, world!") .padding() } } ``` I have tried running `Clean Build Folder` and deleting derived data, but the scenario continues. Additionally, I ensured all my dependencies are up to date and compatible with Swift 5.7. I've also tried running the app in Xcode's debugger, but it doesn't provide more detailed information than the crash log. Could there be some configuration in Xcode that I might have overlooked? Any help would be greatly appreciated! I'm working on a API that needs to handle this. The stack includes Swift and several other technologies. Any examples would be super helpful. The stack includes Swift and several other technologies. Any feedback is welcome! What are your experiences with this?