---
title: CoordinateSpaceProtocol
framework: swiftui
role: symbol
role_heading: Protocol
path: swiftui/coordinatespaceprotocol
---

# CoordinateSpaceProtocol

A frame of reference within the layout system.

## Declaration

```swift
protocol CoordinateSpaceProtocol
```

## Overview

Overview All geometric properties of a view, including size, position, and transform, are defined within the local coordinate space of the view’s parent. These values can be converted into other coordinate spaces by passing types conforming to this protocol into functions such as GeometryProxy.frame(in:). For example, a named coordinate space allows you to convert the frame of a view into the local coordinate space of an ancestor view by defining a named coordinate space using the coordinateSpace(_:) modifier, then passing that same named coordinate space into the frame(in:) function. VStack {     GeometryReader { geometryProxy in         let distanceFromTop = geometryProxy.frame(in: "container").origin.y         Text("This view is \(distanceFromTop) points from the top of the VStack")     }     .padding() } .coordinateSpace(.named("container")) You don’t typically create types conforming to this protocol yourself. Instead, use the system-provided .global, .local, and .named(_:) implementations.

## Topics

### Getting built-in coordinate spaces

- [immersiveSpace](swiftui/coordinatespaceprotocol/immersivespace.md)
- [global](swiftui/coordinatespaceprotocol/global.md)
- [local](swiftui/coordinatespaceprotocol/local.md)
- [named(_:)](swiftui/coordinatespaceprotocol/named(_:).md)
- [scrollView](swiftui/coordinatespaceprotocol/scrollview.md)
- [scrollView(axis:)](swiftui/coordinatespaceprotocol/scrollview(axis:).md)

### Getting the resolved coordinate space

- [coordinateSpace](swiftui/coordinatespaceprotocol/coordinatespace.md)

### Supporting types

- [GlobalCoordinateSpace](swiftui/globalcoordinatespace.md)
- [LocalCoordinateSpace](swiftui/localcoordinatespace.md)
- [NamedCoordinateSpace](swiftui/namedcoordinatespace.md)

## Relationships

### Conforming Types

- [GlobalCoordinateSpace](swiftui/globalcoordinatespace.md)
- [LocalCoordinateSpace](swiftui/localcoordinatespace.md)
- [NamedCoordinateSpace](swiftui/namedcoordinatespace.md)

## See Also

### Measuring a view

- [GeometryReader](swiftui/geometryreader.md)
- [GeometryReader3D](swiftui/geometryreader3d.md)
- [GeometryProxy](swiftui/geometryproxy.md)
- [GeometryProxy3D](swiftui/geometryproxy3d.md)
- [coordinateSpace(_:)](swiftui/view/coordinatespace(_:).md)
- [CoordinateSpace](swiftui/coordinatespace.md)
- [PhysicalMetric](swiftui/physicalmetric.md)
- [PhysicalMetricsConverter](swiftui/physicalmetricsconverter.md)
