Scaled Shape
Scaled Shape
```
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
}
}
}
```
```
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
}
}
}
```
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.
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.
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! 🙌")
}
}
}

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()
}
#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``.
[<-]