Generate Objective-C code that builds Cocoa UIs. Replaces XCode's XIBs
xibless is a library that generates Objective-C code that builds Cocoa UIs. The goal of this library is to replace XIBs in XCode and, if you want, get rid of XCode altogether.
With xibless, instead of designing UIs with a WYSIWYG editor, you build them in a Python script, similarly to what you do when you build Qt UIs without the Designer. For example, a script like this:
result = Window(330, 110, "Tell me your name!") nameLabel = Label(result, text="Name:") nameField = TextField(result, text="") helloLabel = Label(result, text="") button = Button(result, title="Say Hello") nameLabel.width = 45 nameLabel.packToCorner(Pack.UpperLeft) nameField.packRelativeTo(nameLabel, Pack.Right, Pack.Middle) nameField.fill(Pack.Right) helloLabel.packRelativeTo(nameLabel, Pack.Below, Pack.Left) helloLabel.fill(Pack.Right) button.packRelativeTo(helloLabel, Pack.Below, Pack.Right) nameField.setAnchor(Pack.UpperLeft, growX=True) helloLabel.setAnchor(Pack.UpperLeft, growX=True) button.setAnchor(Pack.UpperRight)
would generate Objective-C code that build a form with a name field, a text label and a button. The second part of the script places the widgets on the form appropriately.
Although xibless is written in Python, the Objective-C code it generates has no Python dependency, so this tool is suitable for any Cocoa developer.
xibless runs on Python 2.7 and up. This means that if you’re on OS X 10.7 or newer, you can use the built-in Python. Otherwise, you’ll have to install a more recent version of Python.
Installation and usage: Please refer to the Documentation for installation and usage instructions.
xibless is in very early development and there’s no API documentation yet. For now, you’ll have to figure that API from the demos and by digging directly in the source. Also, note that this API could wildly change before v1.0.
Also, the number of rough edges at the moment are incalculable. There are no error message for invalid UI scripts, so it might be very hard, for now, to figure out why your scripts don’t work.
Oh, yes, and memory leaks, there’s tons of them.
Version 0.3.0 – 2012/07/09
- Added RadioButtons, TableView, TabView, TextView, ImageView and ProgressIndicator.
- Added support for string localization.
- Added TextField.alignment and TextField.textColor.
- Added Button.keyEquivalent.
- Added canClose, canResize and canMinimize to Window.
- Added a Control subclass.
- View can now be directly instantiated in UI scripts (They’re like “Custom Views” in IB).
- xibless run can now be run on script for which the result is a View.
- Improved layout system.
- Window origin is now supplied in terms of screen proportions rather than absolute positions.
- Fixed ‘id’ ownerclass in main function prototype generation and added the “ownerimport” global variable in the UI script.
- Escape newlines in string code generation.
- Added documentation for Button.buttonType and Button.bezelStyle and added a demo for a button with a different bezel style.
- Fixed the most glaring memory leaks.
- Fixed a bug where attributes like class-level default fonts wouldn’t be generated when generating more than one UI script in the same python session.
- Windows are not released when closed by default.
- Added support for circular references (a window setting one of its properties to an item that required that window before being created, for example, initialFirstResponder). We previously couldn’t generate code for such bindings.
- Made the align argument in View.packRelativeTo() optional.
Version 0.2.0 – 2012/06/28
- Added Sphinx documentation
- Added the xibless run command for quick UI previews.
- Added Combobox and Popup.
Version 0.1.0 – 2012/06/25
- Initial pre-alpha release