Notifies you when the size, orientation, or traits of a scene change.
SDKs
- iOS 13.0+
- Mac Catalyst 13.0+
Framework
- UIKit
Declaration
optional func windowScene(_ windowScene: UIWindow Scene, didUpdate previousCoordinateSpace: UICoordinate Space, interfaceOrientation previousInterfaceOrientation: UIInterface Orientation, traitCollection previousTraitCollection: UITrait Collection)
Parameters
windowScene
The window scene object whose environment changed.
previousCoordinateSpace
The previous coordinate space of the scene. Get the current coordinate space from the
coordinate
property of theSpace window
object.Scene previousInterfaceOrientation
The previous interface orientation for your content. Get the current interface orientation from the
interface
property of theOrientation window
object.Scene previousTraitCollection
The previous traits for the window. Get the current window traits from the
trait
property of theCollection window
object.Scene
Discussion
The window scene environment typically changes in response to user actions. For example, the interface orientation changes in response to device orientation changes. Similarly, the user may resize scenes on iPad, which causes UIKit to report a change to the scene's coordinate space. Use these changes to make any needed changes to your scene's content or interface.