How to automatically set MyCellView frame
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// how to set MyCellView frame
view.addSubview(MyCellView())
}
}
@QuickLayout
class MyCellView: UIView {
let titleLabel = UILabel(text: "titleLabel")
let subtitleLabel = UILabel(text: "subtitleLabel")
let imageView = UIImageView()
var body: Layout {
HStack {
VStack(alignment: .leading) {
titleLabel
Spacer(4)
subtitleLabel
imageView.resizable()
}
Spacer()
}
.padding(.horizontal, 16)
.padding(.vertical, 8)
}
}
How to automatically set MyCellView frame