As we don't have a reference to any NSView, I have to use NSApp.orderFrontCharacterPalette(nil). If no text field is focused, the character palette will be useless, so I chose to disable the emoji button if the message bar text field is not focused:
When it's focused, the button shows again:
When tapped, the button shows the palette, at the correct location:
And finally, the button can be used multiple times without ending in a weird state.
As we don't have a reference to any
NSView
, I have to useNSApp.orderFrontCharacterPalette(nil)
. If no text field is focused, the character palette will be useless, so I chose to disable the emoji button if the message bar text field is not focused:When it's focused, the button shows again:
When tapped, the button shows the palette, at the correct location:
And finally, the button can be used multiple times without ending in a weird state.