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

draw(_:at:anchor:)

Draws resolved text into the context, aligning an anchor within the ideal size of the text to a point in the context.

Declaration 宣言

func draw(_ text: GraphicsContext.ResolvedText, at point: CGPoint, anchor: UnitPoint = .center)

Parameters パラメータ

text

The GraphicsContext.ResolvedText to draw. Get resolved text from a Text view by calling resolve(_:). Alternatively, you can call draw(_:at:anchor:) with a Text view, and that method performs the resolution automatically.

point

A point within the rectangle of the ideal size of the resolved text to anchor to a point in the context.

anchor

A UnitPoint within the context to align the text with. The default is center.

Discussion 議論

The current context state defines the full drawing operation. For example, the current transformation and clip shapes affect how SwiftUI draws the text.

See Also 参照

Drawing Text