I don't know whether this sort of thing exists (yet) outside of Xcode/ObjC/Swift... but if it doesn't already, surely it will soon.
But with Xcode 6, we can set up classes as "IBDesignable" and give them "IBInspectable" properties. The result is, when we make a element on the interface builder a custom class that is marked as IBDesignable, the interface builder itself will render the object as it would be drawn if you were to compile and run this code. But it does this without you running your full application.
Moreover, with the IBInspectable properties, through interface builder we can set runtime attributes for the object, such as border color, or whatever. This is different from setting a default value for the property as you might have done before. I can set these properties individually per object (of this same type). Interface builder renders the object with the effects of this property in mind, and when I run my application for real, it will also render the object with the same properties.
To this end, Apple has even introduced a method, prepareForInterfaceBuilder
and a pre-compiler directive, TARGET_INTERFACE_BUILDER
that allows the user to write code that will never be executed by the real application, but that the interface builder can use to set up a preview of the object.
This is actual working code. And some of it is code that will actually be executed by the real app (for example, drawRect
is the method used every time the UI wants to refresh your object, but interface builder also executes this method). But more importantly, for at least me, there's a definite urge to want my interface builder code to work and look really good. If I develop a library of UI objects that I want to distribute to developers, I can make that library significantly better by giving them live-rendered previews of the objects they're playing with right in interface builder so they don't have to go through the effort of compiling their app then getting to the scene that has this custom object just to see how it looks.
I think a tag for this sort of code might be appropriate. It would certainly be applicable to objective-c and swift questions using IBDesignable
in Xcode. It could be applicable to questions involving the XML for an Android layout. Beyond this, I'm not sure of any currently existing IDEs that will do live rendering like Xcode is doing now, but I'd be surprised if we didn't start seeing it more (if it's not already out there--I don't know).
As an example of a question that this tag would be appropriate for: IBDesignable UICheckbox