Instance Method インスタンスメソッド

contentShape(_:_:eoFill:)

Sets the content shape for this view.

Declaration 宣言

func contentShape<S>(_ kind: ContentShapeKinds, _ shape: S, eoFill: Bool = false) -> some View where S : Shape

Return Value 戻り値

A view that uses the given shape for the specified kind.

Parameters パラメータ

kind

The kinds to apply to this content shape.

shape

The shape to use.

eoFill

A Boolean that indicates whether the shape is interpreted with the even-odd winding number rule. あるブール値、それは形状が偶奇曲折数規則で解釈されるかどうかを指し示します。

Discussion 議論

The content shape has a variety of uses. You can control the kind of the content shape by specifying one in kind. For example, the following example only sets the focus ring shape of the view, without affecting its shape for hit-testing:


MyFocusableView()
    .contentShape(.focusEffect, Circle())