Contents

storeOverlayWillStartDismissal(_:transitionContext:)

Indicates that the platform dismisses an overlay.

Declaration

optional func storeOverlayWillStartDismissal(_ overlay: SKOverlay, transitionContext: SKOverlay.TransitionContext)

Parameters

  • overlay:

    An overlay object that’s about to disappear.

  • transitionContext:

    The context you can use to animate changes to UI components when the overlay disappears.

Discussion

Use the transitionContext parameter to animate updates to the UI on the main thread. For example, make a UIImageView appear by animating the change of its opacity to 100%, as shown in the following code:

func storeOverlayWillStartDismissal(_ overlay: SKOverlay, transitionContext: SKOverlay.TransitionContext) {
    transitionContext.addAnimation { [self] in
        self.imageView.layer.opacity = 1
    }
}

See Also

Responding to the Overlay’s Appearance and Disappearance