Instance Property


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


var presentsWithTransaction: Bool { get set }


By default this value is false: MTKView displays the output of a rendering pass to the display as quickly as possible and asynchronously to any Core Animation transactions. However, if your game or app combines Metal and Core Animation content, it's not guaranteed that your Metal content will arrive in the same frame as your Core Animation content. This could be an issue if, for example, your app draws UIKit content (such as labels with a target position and time) over the top of your MTKView and the two domains need to be synchronized.

Setting this value to true changes this default behavior so that your MTKView displays its drawable content synchronously, using whichever Core Animation transaction is current at the time the drawable’s present() method is called.

However, if you allow Metal to choose when to call the present method (by using the present(_:) method of a command buffer), the transaction during which you scheduled presentation might end before the drawable is ready to be presented. To avoid this situation, commit the command buffer and call its waitUntilScheduled() method to synchronously wait until the drawable is ready, then call the drawable’s present() method directly.

See Also

Managing Your Render Target

var autoResizeDrawable: Bool

A Boolean value that controls whether to resize the drawable as the view changes size.

var drawableSize: CGSize

The current size of drawable textures.

var framebufferOnly: Bool

A Boolean value that determines whether the drawable can be used for texture sampling or read/write operations.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software