How to add commands to the file menu of a SwiftUI MacOS app

Within your SwiftUI MacOS app, use the commands modifier and add a CommandGroup that uses after: CommandGroupPlacement.newItem.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 10/23/2024 at 09:32
Last Updated on 10/23/2024 at 09:38
<p>Two flowers that represent SwiftUI and XCode, beneath them sits the text "Add Commands to the File Menu."</p>

Within your SwiftUI MacOS app, use the commands modifier and add a CommandGroup that uses after: CommandGroupPlacement.newItem.

SubscribeDownload Open Source Project

The following tutorial shows code from our upcoming app Object Capture Pro. If you wish to be updated on the progress and release of this app, please subscribe using the link below.

Subscribe

If you are looking to replace or remove the "New Window" command, consult the tutorial below.

How to replace or remove the new window command from the file menu
<p>A screenshot of the Object Capture Pro menu after modifying the commands.</p>

To add commands to the File Menu, use code similar to that below.

Looking to learn more about SwiftUI, Swift, Design and Technology?

Search our blog to learn more about Swift, SwiftUI, design and technology.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe