73 points · by ingve · 8y ago · 72 comments
For our team, storyboards are for flow and they are broken up into individual storyboards where possible. Individual xibs are used for views and view controllers. We don't put any UI in storyboards at all.
Autolayout is as easy or as hard as you want to make it. As with almost all things, less is more. I think people definitely need to have an a-ha moment with it.
I consider it a knock against you if you can't sort out interface builder or autolayout, if I'm being honest.
Disclaimer: I'm admittedly very biased towards cross platform approaches like Nativescript/React Native & Flutter vs taking time out of my day to learn and keep up with Google/Apple's latest "design language" and accompanying tooling. This makes me a terrible mobile developer (no sarcastic/snarky intent), but makes me a very productive developer who happens to have to make mobile apps that are "good enough" sometimes.
Isn't HTML + CSS the universal language for GUI's?
And yes, autolayout is a shitshow, hence the countless utilities and frameworks built on top of it to make it more palatable.
However, if you don’t take your time to understand linear constraint systems, then you’re entering a world of pain.
To work effectively (and correctly) with SQL, you have to learn to think in terms of relations.
To work effectively (and correctly) with AutoLayout, you have to learn to think in terms of linear constraint systems.
Sorry webdevs ¯\_(ツ)_/¯
Source for that?
The only reason to not use it, is because some of those Apps are built with third party multi-platform frameworks and not UIKit (React)
> hence the countless utilities and frameworks built on top of it to make it more palatable
So, having layers of abstraction, now means it sucks?
No, people make layers of abstraction because the underlying layer is useful, powerful, configurable.
People do encapsulate AutoLayout because it works, and is good, or else, they would be doing their own code programatically.
But if you’re working alone on a small project , doing everything in the storyboard could be an option.
Creating a programmatic router to create view controllers is a much better, faster, and most importantly, testable way to do things.
The core point - you can't code review storyboards/XIB - still stands. That makes them untenable for large teams of professional developers where quality matters.
That sounds very reasonable. I find IB to be excellent for creating layouts quickly, especially combined with @IBDesignable and @IBInspectable.
My problem with relying on storyboards has been when I need to reuse a layout in a separate workflows. What’s nice about your technique is that it allows separate storyboards but also layout reuse with nibs.
- In the storyboard, delete the root view for the view controller.
- Create a new xib named the same as the view controller's class and that will get loaded without having to do anything additional.
Here's a quick example of what I'm talking about: https://github.com/jawngee/StoryboardWithXibs
I would disagree with this statement.
I hate anything XML when I have to touch it manually. I greatly prefer yaml or even json for something usable by humans.
Autolayout notation can look confusing, but I have a light background in CAD and I reason with Screw theory. IE what are the smallest number of constraint for my system to be stable …
So to me, oddly, I always found Autolayout easy. https://en.wikipedia.org/wiki/Screw_theory
So... is there an export to/import from JSON option or tool? Seems like this is something that wouldn't be too hard, given you likely have rules for how the XML is supposed to be defined, so if the JSON is ill-formatted it can just report a useful warning about why.
I do, I think they are the best UI design tool out there (used Microsoft tools, Android tools and GTK designer) and simply has no comparasion.
Most of the times, people poo-pooing AutoLayout are people that start rushing out the design without thinking about it, or people that rush to stack overflow to "fix" the problem and don't care to learn the system (apple provied great videos from WWDC).
If the tools were so bad, why do they always seem to achieve a superior result?
I don't want a WYSIWYG editor for UI. No other platform does this. Because it doesn't scale.
Tried to merge storyboards before? Ha.
Even programmatically...I'm sorry, but nobody can convince me that the following is a sane way to create UI:
NSLayoutConstraint.constraints( withVisualFormat: "V:|-23-[appNameLabel]", metrics: nil, views: views)
My perception is that the limited customisability is done on purpose by Apple to enforce a common look-and-feel of UI elements across all apps on the system. Also it of course reduces the API surface that Apple have to maintain.
I pretty much like it, both because it indeeds lead to a more consistent look and feel, but also because makes it easier for us to reject the weirdest design wishes from our clients - we can refer to that implementing the components from scratch will take a lot of time (= money).
For your claim of Microsoft's superiority, I find it very unfounded, it's superior in which way?
With Apple's tools, I can write my on controls, and change my own values and see them updated live in the designer.
I don’t agree with grandparent’s characterization of autolayout, though.
It can generate very complex layouts, without inputing a single line of code.
It's more capable than any other layouting system.
Android XML has a lot of bad stuff in it too. Like all the styling that needs to be done through obscure XML tags, selectors, layer-lists, style-inheritance in separate files and so on.
Also ConstraintLayout is basically AutoLayout, I have been using Anko Layout DSL more and more instead of XML, which then really isn't that different from iOS+SnapKit.
What I loved about Android XML was the live preview stuff. Made dev much, much faster.
Nibs and storyboards are simple, declarative XML files. They just come with a nice GUI editor.
Having spent years on this crap, I can only conclude that it is such a dire, revolting mess for one reason and one reason only: vendor lockin.
You're not going to be taking that UI code anywhere else. And that's the point, imho.
This might have been true when there was a single screen size on iOS and people could get away with hardcoded “pixel perfect” frames, but that’s just sloppy.
That’s how you get half-baked apps that don’t properly support right-to-left languages or accessibility features like dynamic type.
In fact, it's easier to make dynamic views in code. What if you want some part of your layout to change based on the size of a view (as determined by screen size, dynamic type setting, language and so on)? Do you create two separate XIB files? How do you keep them in sync?
Warning: you MUST NOT do this for UITableViewCell/UICollectionViewCells’ contentViews.
But when people use these libraries that “helpfully” set `translatesAutoresizingMaskIntoConstraints = false` for them and they don’t understand what’s going on under the hood, their layout breaks and they start complaining about autolayout being “buggy”.