Autolayout and aligning subviews
Quick question: How would you align all subviews horizontally while keeping their centers aligned using autolayout?
Quick question: How would you align all subviews horizontally while keeping their centers aligned using autolayout?
There are a plethora of wrappers around the AutoLayout engine. They all seem to provide convenience towards making the layout code look cleaner. In all fairness this is due to the fact that the first version of NSLayoutContraint
API was very verbose. But I remember when Apple announced the constraint based layout they were equally excited about providing a what they referred to as ‘ascii based constraints’. The idea is to create constraints between siblings and parent UI elements in a string based format. They even provide a guide to “Visual Format Language” aka VFL.
So it turns out apart from the fonts that come packaged with the Apple platforms you can also download a bunch of fonts at runtime There is a list that Apple has made available that you can find here https://developer.apple.com/fonts/system-fonts/.
So today I happened to need something which has an storage of an Array
but can not grow. And instead of Int
I need a named lookup, like a Dictionary
. But then again I don’t want to deal with Optional
s. I want the initial values to be populated during the init
so that lookups can never be nil
. Does such a thing already exists? In Swift I mean. I guess not, so obviously the next step is to make such a thing. I’m calling it EnumArray
.
One of my most favorite thing about SwiftUI is neither the declarative API nor the mystical fancy syntax but rather the philosophy of one directional flow of data and event. I’ve been trying to put that philosophy into practice for quite a while now with whatever framework I use.