Stevia: Human-readable auto-layout in code
github.com
github.com
https://github.com/SnapKit/SnapKit
box.snp_makeConstraints { (make) -> Void in
make.width.height.equalTo(50)
make.center.equalTo(self.view)
}https://github.com/SnapKit/Masonry
[box mas_makeConstraints:^(MASConstraintMaker* make) {
make.width.height.equalTo(50);
make.center.equalTo(self.view);
}];https://github.com/robb/Cartography
constrain(button1, button2) { button1, button2 in
button1.right == button2.left - 12
}https://github.com/viewfinderco/viewfinder/blob/master/clien...
[self addConstraints:box.anchorWidth == 50];
[self addConstraints:box.anchorHeight == 50];
[self addConstraints:box.anchorCenterX == self.view.anchorCenterX];
[self addConstraints:box.anchorCenterY == self.view.anchorCenterY]; [box.widthAnchor constraintEqualToConstant:50].active = YES;
[box.centerAnchor constrantEqualToAnchor:self.view.centerAnchor].active = YES;PHP templates -"WordPress" -"joomla" -"codeignitor" -"drupal"
If a query comes up with junk I usually replace 'go' with 'golang'.
This just raises the mental burden and lowers discoverability.
But I can say from a beginner to iOS standpoint that this looks amazing and I will put it to use in an app I am building immediately, as soon as I can figure out how.
To the author of this library, thank you.
You also get a number of other advantages, like moving UI operations off of the main thread (which is often a pain point in iOS apps shooting for 60fps).
https://developer.apple.com/library/prerelease/ios/documenta...
Three reasons mostly motivated us : 1. having the compiler on our side and not just hope the string would parse fin at runtime. 2. Laying out Horizontal and Vertical layout at the same time 3. Having something readable cause readable == maintainable :)
https://github.com/s4cha/Stevia/tree/master/Stevia/Stevia
Screenshot: http://imgur.com/5EPUNeZ
Programmatic layouts/constraints just crumble underneath you when Apple decides to make changes in each new version of iOS or introduces a new formfactor.
I remember that when DHTML/Javascript was young, from 1998-2004, you used the features built into every browser or you'd find yourself painted into a corner with the next release. Java applets, VBScript, ActiveX, Flash, and numerous third-party plugins: all dead. And then suddenly, around 2005, Prototype/JQuery/YUI/Dojo all came out, and you were an idiot if you didn't use a third-party library. The pendulum is starting to swing the other way now that browsers are pretty reliably standards-based, but there are still a number of people who look at you funny when you suggest using vanilla JS.
I was a little young to remember, but IIRC the same thing happened with the PC: through most of the early 80s, if you didn't write in assembly and use the specific features provided by each vendor, your app didn't have a chance. Then 1990 rolled around, decent C/Pascal compilers came out, third-party class libraries took off, and you got left behind if you still coded in assembly. Then by the early 2000s things had centralized under Microsoft .NET again, but by then the web was taking off and nobody cared.
It seems like this is the pattern of most software platforms: for the first 10 years, you better code to proprietary APIs because you won't be able to accomplish anything otherwise, and if you do it'll be obsolete with the next OS release. For the next 10 years, an explosion of third-party frameworks takes off, and you pick the one that makes you the most productive. In the last 10 years, things centralize again under a monopoly vendor, but by then the platform is already getting obsolete. Not sure where we are in the cycle for iOS - we've probably got a couple years to go - but it looks like it may be happening in Android land already, with Dagger 2 and RxJava.
I sympathize somewhat with the grandparent poster's point, but it all depends on how likely Apple is to improve auto-layout vs. how many new developers need an easier layout system now. JQuery managed to become massively popular on the web, despite web browsers eventually adopting most of its innovations, because the browsers took years to incorporate its innovations (and sometimes never quite got the syntax right) while millions of people needed to make a webapp right now.
And of course, some people find markdown more user-friendly than a visual GUI for more or less the same reasons, so it should not be that surprising to find some people experiment with this.
And of course, autolayout has a text-based language of its own (https://developer.apple.com/library/ios/documentation/UserEx...)
in my personal opinion, IB is great for layout of one view or screen, especially with the new IBDesignable and IBInspectable features.
doing app navigation in a storyboard is a terrible idea and will lead to a monolithic storyboard file that is very annoying to work with.
The editor on its own is fairly nice to use these days, but it outputs obtuse XML and has a propensity to edit parts of the layout XML file that weren't actually modified. This makes source-control level collaboration and especially code review very difficult. To make things worse, for a long time the tooling encouraged putting almost all UI into one giant "Storyboard XML" file, guaranteeing confusion and conflicts.
The editor was also quite slow and crashy for years which drove the proliferation of these libraries and the "don't use the storyboard editor" meme accompanying them. It's gotten a lot better in the last ~2 years and I haven't had a crash in heavy day-to-day usage for quite some time.
If Apple could improve the XML output format to be easier to review, eliminate the serialization/deserialization weirdnesses, introduce a visual diff-and-merge tool, and improve the performance just a bit more, the Interface Builder would be excellent, but as is, I see why a lot of people don't like using it, especially on big projects with many collaborators.
I experimented with this a little in a game I was working on. You just need a standard way of displaying everything, then automatically generate the UIs.