scaledToFit
Scale a view to fit while preserving its aspect ratio.
scaledToFit() scales a view to fit inside its proposed size while preserving the view's aspect ratio. It can be applied to any view.
import { Modifier, Symbol } from "onescript/views"
<Symbol
source="pika"
name="photo.image.default.fill"
resizable
modifier={Modifier
.scaledToFit()
.frame({ width: 240, height: 160 })}
/>For an Image or Symbol, enable resizable when the content should resize. Modifier order participates in layout; place frame() before or after scaledToFit() according to which size proposal the view should receive.
For the SwiftUI semantics and layout behavior of this modifier, see Apple's scaledToFit() documentation.
How is this guide?
Last updated on