0

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?

2
  • Why use Mac Catalyst for a SwiftUI app? Why not setup your SwiftUI project with a native Mac build? Commented Nov 6, 2024 at 16:34
  • Our primary app is an iOS app, and we converted that easily as a catalyst, and it worked flawlessly so far. This is the only issue we are encountering (+ that mouse support is limited). Creating a completely new one with shared code would require a lot of work. 90% of our users are coming from iOS. Commented Nov 7, 2024 at 9:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.