Contents

addPresentedHandler(_:)

Registers a block of code to be called immediately after the drawable is presented.

Declaration

func addPresentedHandler(_ block: @escaping  MTLDrawablePresentedHandler)

Parameters

  • block:

    A block of code to be invoked.

Discussion

You can register multiple handlers for a single drawable object.

The following example code schedules a presentation handler that reads the presentedTime property and uses it to derive the interval between the last and current presentation times. From that information, it determines the app’s frame rate.

See Also

Getting presentation information