TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Suppressing File->New without affecting Open/Open Recent?

Forums > SwiftUI

SwiftUI continues to frustrate me.

I'm writing a simple app that can only open images (and export them in different formats). I want to remove the File->New menu item. One thing I found, which works, is to add this:

        .commands
        {
            CommandGroup(before: CommandGroupPlacement.newItem) { }
        }

Unfortunately, that also removes Open and Open Recent, with no obvious way to easily replace them (that is, I don’t think I should have to reimplement those well-defined behaviors).

A similar problem exists with .saveItem: replacing those commands also removes the Close command.

2      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.