How to create a MainMenu.nib file for macOS

From the source code (createMenuBar()):

This is nasty, nasty stuff – calls to undocumented semi-private APIs that could go away at any moment, lots of stuff that really should be localize(d|able), etc. Add a nib to save us this horror.

A couple months ago, I tried to add a nib to kitty but pretty much gave up after spending a couple hours searching for documentation and trying different things.
After finding almost no information on how to actually create such a file, I created a new Xcode project without storyboards, changed the main menu with Xcode’s graphical interface and then copied the MainMenu.nib file from the compiled .app binary to kitty. This almost worked. The new main menu items showed up when starting kitty and I could even get translations working but calling a function in kitty when clicking on one of the menu items never worked in any of my attempts.
Is this really the right way to do this? There must be a better way (that actually works), right?
I’m happy to provide any additional information that might be required to properly answer my question as I didn’t explain everything I did in detail because this is probably not the right way to do this anyways.