The original shape, before the scale.
```
struct DiskView: View {
var body: some View {
let scale = CGSize(width: 0.5, height: 0.5)
let scaledShape = ScaledShape(shape: Circle(), scale: scale)
return ZStack {
scaledShape
.shape.fill(Color.red)
scaledShape
.opacity(0.7)
}
}
}
```

The scale factor.
```
struct ContentView: View {
var body: some View {
let scale = CGSize(width: 0.5, height: 0.5)
let scaledShape = ScaledShape(shape: Circle(), scale: scale)
return VStack {
Text("↔️scaled by \(scaledShape.scale.width)")
Text("↕️scaled by \(scaledShape.scale.height)")
scaledShape
}
}
}
```

The unit point to scale the view from.
```
struct ContentView: View {
var body: some View {
let scale = CGSize(width: 0.5, height: 0.5)
let scaledShape = ScaledShape(shape: Circle(), scale: scale)
let anchor = scaledShape.anchor
return VStack {
Text("Anchored at (\(anchor.x), \(anchor.y)) ⚓️")
scaledShape
}
}
}
```
![A screenshot displaying a black filled circle in the center of the
screen with text at the top of the screen that describes the location of
anchor in both dimensions. The anchor location is retrieved by the
anchor property of the scaledShape object. In this case the anchor is
located at the center of the screen, so the reading is (0.500000,0.500000).]
(scaledshape-anchor.png)
Creates a scaled shape from an original shape, a scale factor, and an anchor
point.
```
struct HugeShapeView: View {
var body: some View {
ScaledShape(shape: Rectangle(),
scale: CGSize(width: 0.5, height: 0.5),
anchor: .center)
.border(Color.orange)
.padding()
}
}
```

- Parameters:
- shape: The shape to be scaled.
- scale: The factor to scale the shape.
- anchor: The unit point to scale the shape from. Defaults to the center.
Describes this shape as a path within a rectangular frame of reference.
- Parameter rect: The frame of reference for describing this shape.
- Returns: A path that describes this shape.
The type defining the data to animate.
The data to animate.
The type of view representing the body of this view.
When you create a custom view, Swift infers this type from your
implementation of the required `body` property.
This protocol is used to create different content areas on the screen.
On-screen ``Scene``s are the building blocks of any app built entirely in SwiftUI.
They can look
different depending on the platform the app is running on. For example, in iOS,
the screen usually
only displays one scene at a time. In macOS, every window in an app might be a
different scene.
Scenes can either be custom, or one of the primitives like ``WindowGroup`` or
``DocumentGroup``.
### Creating a Scene
#### Using primitive Scenes
Primitive scenes like `WindowGroup` can go directly in the body of your ``App``.
@main
struct SuperSimpleApp: App {
var body: some Scene {
WindowGroup {
Text("This is an entire app! 🙌")
}
}
}

#### Using custom Scenes
Just like how custom ``View``s are made out of a `var body` of smaller ``View``s,
custom ``Scene``s are made out of a `var body` of smaller ``Scene``s.
@main
struct MacCompatibleApp: App {
var body: some Scene {
CustomScene()
}
struct CustomScene: Scene {
var body: some Scene {
WindowGroup {
Text("This is a mac-compatible app! 💻")
}
#if os(macOS)
Settings {
SettingsView()
}
#endif
}
}

### Modifiers
Just like how ``View``s have a bunch of custom modifiers that work right out of
the box,
``Scene`` provides default implementations of many useful modifiers. These can be
used to do things
like adding macOS commands, changing the toolbar, and adding support for app
storage.
[scene-phase ->]
### Getting Scene Status
The ``EnvironmentValues/scenePhase`` environment value can easily be read in a
scene
to respond to whether the scene is active or in another state. It returns an
enumeration of type
``ScenePhase``.
struct StateAdaptingScene: Scene {
@Environment(\.scenePhase) private var scenePhase
var body: some Scene {
WindowGroup {
Text(scenePhase == .active ? "Active!" : "Inactive")
}
}
}
[<-]