Instance Property

currentDrawable

The drawable to use for the current frame.

Declaration

var currentDrawable: CAMetalDrawable? { get }

Discussion

If all drawable objects are in use, the value of this property is nil. Your app should check that currentDrawable isn’t nil before attempting to draw. The view changes the value of this property only after returning from a drawing function, either draw(_:) from a subclassed instance of the view, or draw(in:) from the view’s delegate.

Use a MTLRenderCommandEncoder object to render into the drawable’s texture and present it for display (typically registered using the present(_:) method of a command buffer). Try to minimize the time between when you fetch the drawable and when you submit the command buffer that uses it. For more information, see Keeping References to Drawables.

See Also

Retrieving Render Target Information

var currentRenderPassDescriptor: MTLRenderPassDescriptor?

A render pass descriptor to draw into the current drawable.

var depthStencilTexture: MTLTexture?

A packed depth and stencil texture associated with the currentDrawable object’s texture.

var multisampleColorTexture: MTLTexture?

The multisample color sample texture to render into.