A closure that receives a CGContext
that you use to perform drawing operations, just like you draw into a Graphics
instance. Any filters, blend mode settings, clip masks, and other state set before calling with
apply to drawing operations in the Core Graphics context as well. Any state you set on the Core Graphics context is lost when the closure returns. Accessing the Core Graphics context after the closure returns produces undefined behavior.
Instance Method
インスタンスメソッド
with
withCGContext(content:)
Provides a Core Graphics context that you can use as a proxy to draw into this context.
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
content
Context CGContext(content:)
Discussion 議論
Use this method to use existing drawing code that relies on Core Graphics primitives.