3

Using the new SwiftUI App model, how can I set the items available on the Menu titled my app name (next to the Apple logo)?

Using the following

WindowGroup {
    …
}
.commands { 
    CommandMenu("Menu Name") {
        Button(action: {}) { Text("Menu Item") }
    }
}

Will place menus after File, Edit and View. I wish to add an item to the menu titled my app name.

1 Answer 1

12

Instead of using a CommandMenu, use a CommandGroup and set its positioning to be one of .appInfo, .appSettings, .appTermination, .appVisibility, or .systemServices.

For example

WindowGroup {
    …
}
.commands { 
    CommandGroup(after: .systemServices) { 
        Button(action: {}) { Text("hi") } 
    }
}
Sign up to request clarification or add additional context in comments.

Comments

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.