Tips
It's OK to override layoutSubviews
This is a great way to add custom layout logic to your view.
@QuickLayout
final class ViewWithAdditionalLayoutBehaviour: UIView {
let label = UILabel()
var body: Layout {
...
}
/// Feel free to override layoutSubviews to customize your layout.
override func layoutSubviews() {
super.layoutSubviews()
label.frame = ....
}
}
It's OK to override sizeThatFits
@QuickLayout
final class ViewWithFixedSize: UIView {
var body: Layout {
...
}
/// 👍 It's OK to override sizeThatFits
override func sizeThatFits(_ size: CGSize) -> CGSize {
/// Note you can achieve the same result
/// by using the `.frame(height: 100)` modifier in the body.
CGSize(width: size.widith, height: 100)
}
}