Structure¶
TransformedShape¶
A shape with an affine transform applied to it.¶
Declaration¶
@frozen struct TransformedShape<Content> : Shape where Content : Shape
Overview¶
A transformed shape has two use cases:
- Used directly via its initializer init(shape:transform:).
- The return value of transform(_:).
Having an offset shape is helpful because it allows you to translate a shape and then continue to use its shape properties, instead of turning into View.
A simple example of constructing a TransformedShape:
struct TransformedShapeView: View {
let transform = CGAffineTransform(rotationAngle: 0.5)
var body: some View {
TransformedShape(shape: Rectangle(), transform: transform)
.frame(width: 100, height: 100)
.border(Color.orange)
}
}

Availability¶
iOS 13.0+
macOS 10.15+
tvOS 13.0+
watchOS 6.0+
Topics¶
Type Alias¶
AnimatableData The type defining the data to animate.
Body The type of view representing the body of this view.
Instance Method¶
path(in:) Describes this shape as a path within a rectangular frame of reference.
Instance Property¶
animatableData The data to animate.
shape The original shape to be affine transformed.
transform The affine transformation to apply to the original shape
Initializer¶
init(shape:transform:) Creates a new shape from an original shape and an affine transform.