Programatically implementing interfaces on iOS is too verbose in my opinion. Sure, you could do it in IB but I fancy reusing my code and I hate having to change one thing in 10 different places or spreading my interface in 100 IB files to avoid that. Also, IB is very slow, although I own a new generation Macbook Pro, I still have to wait 3-4 seconds to open large files, not to mention the lack of zoom and the general clumsiness makes me run when I hear about it.
Now, to the question at hand, is there any open source effort or otherwise a way to describe the layout (not necessarily the view "logic"), just the layout in HTML or any other markup language.
So far I've seen that CALayer
has a style
property that could be used, however, it doesn't support positioning. Also, I tried to use UIWebView
but it seems to force me to have my logic inside HTML code as well, which I don't want to, plus, it's slower.
What else could I try?
You could have a look at Nimbus CSS. It does exactly what you're looking for in CSS. It supports positioning and it's pretty stable.
I realize this question is a couple of years old, but in case anyone else is looking for something similar, take a look at MarkupKit:
https://github.com/gk-brown/MarkupKit
It's an open-source framework I created that allows you to build native iOS apps in markup. For example, you can create a label instance like this:
<UILabel text="Hello, World" font="System 24" textColor="#ff0000"/>
rather than this:
UILabel *label = [UILabel new];
[label setText:@"Hello, World"];
[label setFont:[UIFont systemFontOfSize:24];
[label setTextColor:[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0]];
It also supports dynamic localization and CSS-like styling, among other things.
Complete project documentation can be found here:
https://github.com/gk-brown/MarkupKit/blob/master/README.md
Examples and other information are available in the wiki:
https://github.com/gk-brown/MarkupKit/wiki
Hope you find it useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With