I'm creating all programatically with Swift 3 and SnapKit for the AutoLayout.
I would like to have a View object that contains # amount of views with different sizes (including UILabels without size because accessibility) and with the following behaviour when doesn't fit.
I thought in doing that by hand but if I try to get the width of the subviews before to show the view at the screen the result is 0 until are not there (viewDidAppear). I can get the width of the superview but without the size of the subviews for rearranging is nothing to do.
The plan is adding that component to different places on the app then should be almost independent from the ViewController.
I don't understand how a basic functionality in Android becomes a nightmare in iOS. Maybe I'm missing something but...
Thanks for all.
Finally the way I fixed my problem was doing it manually. It's not the best solution but was the most "clean" for my scenario. I didn't want to add more layers of complexity with UICollectionView that then I should configure, adapt and fit to the others flexible components of the screen, for a basic component that supose to be a detail, not a big thing.
My main problem for calculating the sizes was that I'm using labels inside the small components and those have specific sizes depending content and accessibility.
My solution basically use the MyCustomLabel.intrinsicContentSize for knowing the future size and make the calculations. I override the object because my labels are using special sizes.