Generate Objective-C code that builds Cocoa UIs. Replaces XCode's XIBs
Project description
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(200, 200, 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.
Why xibless?
For many people XCode and its integrated interface builder work fine and to be fair, XCode is a nice tool. However, it has shortcomings, mostly just annoyances, but still, after a while, annoyances become… annoying. For example, when a XIB UI reaches a certain level of complexity, you never know, when doing minor updates, if you mistakenly messed up something else. Because every modification, however minor it is, changes a big part of the XIB file, you can’t tell in the diff if the modification you’ve made was exclusively the one you wanted to make. There’s also XIB localization, with its one-xib-copy-per-localization, which is less than optimal but hard to work around. Anyway, I’m not going to try to convince you. If you don’t already want to get rid of XCode and/or XIBs, you probably don’t need xibless.
Installation
You can install xibless through pip:
pip install xibless
or by downloading the source package and running:
python setup.py install
To build the demos in the demos folder, cd into it and type:
./waf configure ./waf
The resulting app will be in the build folder.
Usage
xibless can be used either from the command line or through Python. To use it from the command line, you type:
xibless <source> <dest>
source is the path of the Python module you wrote that describes the UI you want to build. dest is the path you want your resulting Objective-C file to be written at. To use xibless directly from Python, the usage is similar:
import xibless xibless.generate(source, dest)
Now, all this does is that it generates UI code. xibless hasn’t, yet, any integrated solution to let you easily build a XCode-less program. However, what you can do is to look at the demos folder and base yourself on those demos (which are completely XCode-less) to build your own project.
Early Development
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.
Changes
Version 0.1.0 – 2012/06/25
Initial pre-alpha release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.