Viktor Maric
Viktor Maric

Reputation: 603

Mac Catalyst DocumentGroup shows blank view when "Optimize for Mac" is enabled

I'm developing a document-based SwiftUI app using Mac Catalyst with DocumentGroup. When creating a new document or opening an existing one, the view appears completely blank, but only when "Optimize for Mac" is enabled in the target settings. The view displays correctly when using "Scaled to Match iPad" instead.

Environment Xcode 16.1 macOS 15.1 SwiftUI with Mac Catalyst Document-based app using DocumentGroup

Code

struct DocumentGroupTestApp: App {
    var body: some Scene {
        DocumentGroup(newDocument: WritingAppDocument()) { file in
            TestView() // Blank when "Optimize for Mac" is enabled
        }
    }
}

struct TestView: View {
    var body: some View {
        Text("Hello, World!")
    }
}

Expected Behavior

The TestView should display its content ("Hello, World!" text) when the document is opened or created The view should work correctly regardless of the Mac Catalyst optimization settings

Actual Behavior

When "Optimize for Mac" is enabled: The view appears completely blank When "Scaled to Match iPad" is enabled: The view works as expected

What I've Tried

Confirmed the issue only occurs with "Optimize for Mac" setting Verified the basic view works in iPad mode

Has anyone encountered this issue or knows how to fix the blank view while keeping "Optimize for Mac" enabled?

Upvotes: 0

Views: 55

Answers (0)

Related Questions