scaleEffect

Scales this view's rendered output by the given amount in both the horizontal and vertical directions, relative to an anchor point.

View ModifieriOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+visionOS 1.0+

Overloads

3 ways to call compose().scaleEffect(). Each is one SwiftUI overload, picked by the arguments you pass.

React
compose().scaleEffect(
  s: number,
  options?: {
    anchor?: SwiftUI.UnitPoint;
  }
)
Swift
nonisolated func scaleEffect(
    _ s: CGFloat,
    anchor: UnitPoint = .center
) -> ModifiedContent<Self, _UniformScaleEffect>
1 more Swift overload share this form
Swift
nonisolated func scaleEffect(
    _ s: CGFloat,
    anchor: UnitPoint = .center
) -> some View

Parameters

  • s*number

    The amount to scale the view in the view in both the horizontal and vertical directions.

  • options.anchorSwiftUI.UnitPoint

    The anchor point with a default of UnitPoint.center that indicates the starting position for the scale operation.

Discussion

Use scaleEffect(_:anchor:) to apply a horizontally and vertically scaling transform to a view.

Image(systemName: "envelope.badge.fill")
    .resizable()
    .frame(width: 100, height: 100, alignment: .center)
    .foregroundColor(Color.red)
    .scaleEffect(2, anchor: .leading)
    .border(Color.gray)

See also

More in Visual effects.