Nibbler is a Python PyOjbC utility for displaying dialogs using .nib files.
The best way to play with nibbler is to download this git repo and play with the two example files.
Download this repo:
git clone https://github.com/pudquick/nibbler.git cd nibbler/examples
Now you can choose between running the
Now that you've seen what nibbler does from the examples you'll likely want to build your own dialog box. To get started you'll need:
- A Mac with Python (fortunately all modern Macs come with this built-in)
- The PyObjC bridge (again comes built-in)
- Xcode (available from the MAS or Apple Developer Portal)
Once the requirements above are meet we're able to create our dialog.
- Launch Xcode.
- From your menu bar select
File > New > File....
- For the correct template in Xcode 8, select
Nextand you'll be prompted to save your file. Select a name and location.
- Now we need to get this file into a
.nibfile. From your menu bar select
File > Export.... Make sure and change your File Format to
Interface Builder Cocoa NIB.
- Now you need to write the python code to connect your elements.
- Make sure and give all of your UI elements in Xcode a static identifier. Xcode by default sets identifiers to
Automatichowever that does not work with nibbler.
- Printing your content handles is very helpful:
- Printing your views can also help with troubleshooting:
- Consult Apple's macOS Human Interface Guidelines for the authoritative source on the correct usage of UI elements.
- Consult Apple's Start Developing iOS Apps (Swift):Build a Basic UI for a tutorial on building a UI in Xcode.