storeOverlayWillStartPresentation(_:transitionContext:)
Indicates that the platform presents an overlay.
Declaration
optional func storeOverlayWillStartPresentation(_ overlay: SKOverlay, transitionContext: SKOverlay.TransitionContext)Parameters
- overlay:
An overlay object that’s about to appear.
- transitionContext:
A context you can use to animate changes to UI components as the overlay appears.
Discussion
Use the transitionContext parameter to animate updates to the UI on the main thread. For example, make a UIImageView disappear by animating the change of its opacity to 0% as shown in the following code:
func storeOverlayWillStartPresentation(_ overlay: SKOverlay, transitionContext: SKOverlay.TransitionContext) {
transitionContext.addAnimation { [self] in
self.imageView.layer.opacity = 0
}
}