I'm trying to write a simple image converter app. I want it to open any image file, and export that image as another type. I started with the multiplatform document app template in Xcode 15b2, and suppressed the New command with
.commands
{
CommandGroup(replacing: CommandGroupPlacement.newItem) {}
}
I also changed the document readable types:
static var readableContentTypes: [UTType] { [.image] }
So far, so good. Then I tried modifying the document type declaration to be public.image
, and removed the Imported UTI (reasoning that it’s a standard type and shouldn’t need to be redundantly declared, and how can I possibly list all the possible image filename extensions?), but I’m not at all sure I did that right.
And somewhere in all that, I noticed that my File menu no longer has an Open command. Does SwiftUI look at the declared document type or imported UTIs to decide what the File menu should look like?
UPDATE: Ah, suppressing the New menu also suppressed the Open/Open Recent menu items. That's frustrating.