Instance Property


A Boolean value that determines whether the layer presents its content using a Core Animation transaction.


@property BOOL presentsWithTransaction;


By default, this value is NO; CAMetalLayer displays the output of a rendering pass to the display as quickly as possible and asynchronously to any Core Animation transactions. Core Animation doesn’t guarantee that the Metal content arrives in the same frame as other Core Animation content. This behavior could be an issue if, for example, your app draws UIKit content over the top of your CAMetalLayer.

Setting this value to YES makes the layer draw its contents synchronously, using whichever Core Animation transaction is current at the time you call the drawable’s present method. To ensure that a transaction is available when you schedule the drawable to be presented, first commit the command buffer containing your Metal rendering commands. Then, call its waitUntilScheduled method to synchronously wait until the command queue schedules the command buffer to execute on the GPU. Finally, call the drawable’s present method.

See Also

Configuring Presentation Behavior


A Boolean value that determines whether the layer synchronizes its updates to the display’s refresh rate.