Resizable
extension UIView {
func resizable(axis: AxisSet = [.horizontal, .vertical]) -> Element
}
Makes the view ignore its intrinsic size (size returned by sizeThatFits). If no axis specified, the target view becomes fully flexible along both axes. If only one axis is specified, the target view intrinsic size is preserved along the other axis.
The snippet below
var body: Layout {
HStack {
faceImageView1
.frame(width: 40, height: 40)
faceImageView2
.resizable()
.frame(width: 40, height: 40)
}
}
will result in the following layout:
