subtracting

Returns a new shape with filled regions from this shape that are not in the given shape.

Shape ModifieriOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+subtracting(_:eoFill:) in SwiftUI

Declaration

React
compose().subtracting(
  other: SwiftUI.Shape,
  options?: {
    eoFill?: boolean;
  }
)
Swift
@export(implementation) nonisolated func subtracting<T>(
    _ other: T,
    eoFill: Bool = false
) -> some Shape
where T : Shape

Parameters

  • The shape to subtract.

  • options.eoFillboolean

    Whether to use the even-odd rule for determining which areas to treat as the interior of the shapes (if true), or the non-zero rule (if false).

Return value

A new shape.

Discussion

The filled region of the resulting shape is the filled region of this shape with the filled region other removed from it.

Any unclosed subpaths in either shape are assumed to be closed. The result of filling this shape using either even-odd or non-zero fill rules is identical.

See also

More in Shape modifiers.