With the Xcode 7 and iOS 9 release, we received many “gifts” to help us be more productive in terms of development and maybe a bit happier developers. There is still, as always, room for improvement, but each step that moves us forward, and any Xcode feature which makes our work a bit easier, is more than appreciated.
Now for me the most exciting feature is Stack View. How does it work? UIStackView is a non-rendering subclass of UIView, intended for managing layout of its subviews. It works along a vertical or horizontal axis, with the exact arrangement determined by the distribution, alignment and spacing properties like equal distribution of views, equal spaces between views, centered vies, etc. It’s a virtual container where you can put different views, and you don’t have to worry about setting up any constraints. You just drag and drop the views into the Stack View, and when the code is running, the layout will behave exactly as it was pre-defined. You can also select multiple existing views and group them in a new Stack View with just one click.
You can nest together as many Stack Views as you want, so in theory you can create almost any layout using this technique. If you are familiar with the spacers technique and constraint multipliers (which you should be :) ), you’ll love how much time you'll save using Stack Views. It’s like getting a free cake instead of having to buy all the ingredients to bake your own cake. Yes, maybe your cake will taste a bit better, but the time demand is incomparable!
Using all the tricks that Auto Layout offers, you’ll save time, and many developers are already in love with it. But there are still a lot of developers out there, who don't care about responsive layouts. Some of them complain Auto Layout is too complicated, and others say it’s a nuisance having to deal with so many different constraints and priorities. So what is the easiest way to force all developers to make attractive responsive layouts with minimum effort? The answer is Stack Views.
Should we only use Stack Views from now on? Should we just toss out all our knowledge on constraints and techniques? Of course not. We will still work with constraints, but much less than before. Most of the time, you will need a mixture of constraints and Stack Views. When you need to add some cool features like animations, it’s best to use proven tools.
I’m looking forward to seeing better and more responsive layouts. After playing around with tvOS, I can see that the new Apple TV is the main reason why Apple introduced this new way of making layouts. As always, the software must be ready before the new hardware released. Stay tuned!
You might also like...
News From DockerCon19
Docker Containers are hands down one of the most popular ways to deploy apps. So, of course, STRV’s Backend Team couldn’t miss the biggest Docker conference of the year: DockerCon.Even though the conference focused primarily on Enterprise f...
AR in mobile games
As STRV’s resident game developers, Simon Kautzky and Martin Novak are two very busy guys. Luckily, we got a moment to sit down with them to hear about their current titles, what it’s like building games designed for user relaxation with Un...
How to Set up Blockchain in Your Node.js Project
We’ve covered how Blockchain works, and how to use it. That’s enough theory. Let’s get to the fun bit—actually putting our knowledge to use.Like our content, what we do and how we do it?SUBSCRIBE TO OUR NEWSLETTER Multichain & a small a...