what are coordinate spaces in iOS ?

Asked on 01/21/2025

1 search

Coordinate spaces in iOS are tools used to specify positions relative to a particular frame of reference. In the context of Apple's platforms, different coordinate spaces are used to manage how content is positioned and rendered on the screen or in a 3D environment.

For example, in SwiftUI, there are local and global coordinate spaces. The local coordinate space refers to the current view's coordinate space, with the origin at the top left of the view. The global coordinate space refers to the window's coordinate space, with the origin at the top left of the window.

In VisionOS, a new immersive coordinate space was introduced, which fits alongside SwiftUI's existing coordinate spaces. The immersive space has its origin defined as the point on the ground below you, and it is used to create rich immersive experiences that extend beyond the window into the real world. This is particularly useful for applications that involve augmented reality or mixed reality, where precise positioning relative to the user's environment is crucial.

For more details, you can refer to the session Dive deep into volumes and immersive spaces (19:38).