When adding the code below the subview appears way out of where I intended it to be. It appears almost outside the parent view, and not inside as I expected. I am trying to add the view in viewDidLoad
-method.
Parent view bounds:
(0.0, 0.0, 336.0, 200.0)
I am trying to add a view as a subview of this parent:
let subView = UIView(frame: CGRect(x: 200.0, y: 0.0, width: 100.0, height: 20.0))
Answer: How can I get a view's current width and height when using autolayout constraints?
Following the answer fixes the problem without me understanding it fully. Isn't the size of the view updated when laid out by auto layout? Why do I need to invoke this method?
Before I invoke this method the width of the view is 336 points and after I invoke it it is 215 points.