UIScrollViews and auto layout
UIScrollViews are a different kind of beast when created with auto layout, but the basic idea is to constrain it to a fixed frame, and let the constraints of its subviews determine its contentSize. So let's start with that:
private lazy var scrollView: UIScrollView = {
let sv = UIScrollView(frame: CGRect.zero)
self.view.addSubview(sv)
sv.translatesAutoresizingMaskIntoConstraints = false
sv.alignTop("0", leading: "0", bottom: "0", trailing: "0", toView: self.view)
return sv
}()We have a scrollView that is the same size of our view, nothing fancy.