Post

Replies

Boosts

Views

Activity

Reply to macOS Emoji picker does not work in SwiftUI App
I was seeing this when running my app on macOS 11; so for older versions, I added the menu option manually to get the keyboard shortcut working as expected. On your WindowGroup in your App file:         .commands {             CommandGroup(after: CommandGroupPlacement.textEditing) { // place the new command after existing text editing commands                 if ProcessInfo().operatingSystemVersion.majorVersion < 12 { // only add for specific versions                     Button {                         NSApplication.shared.orderFrontCharacterPalette(nil) // to open the emoji popover                     } label: {                         Text("Emoji & Symbols") // match what is added automatically on newer versions                     }                     .keyboardShortcut(.space, modifiers: [.control, .command]) // match what is added automatically on newer versions                 }             }         }
Dec ’22