nextDrawable()
Waits until a Metal drawable is available, and then returns it.
Declaration
func nextDrawable() -> (any CAMetalDrawable)?Return Value
A Metal drawable. Use the drawable’s texture property to configure a MTLRenderPipelineColorAttachmentDescriptor object for rendering to the layer.
Discussion
A CAMetalLayer object maintains an internal pool of textures for displaying layer content, each wrapped in a CAMetalDrawable object. Use this method to retrieve the next available drawable from the pool. If all drawables are in use, the layer waits up to one second for one to become available, after which it returns nil. The allowsNextDrawableTimeout property affects this behavior.
This method returns nil if the layer’s pixelFormat or other properties are invalid.