Modifiers
containerShape
Sets the container shape for the view.
containerShape(shape)
| Parameter | Type | Description |
|---|---|---|
shape | Shape | A shape configuration from the shapes API |
Sets the container shape for the view.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
You can add containerShape to any view. It changes what you see on 20 of the 39 components.
No visible effect
These components accept it, but you see no change.
| Component | Why nothing happens |
|---|---|
| Spacer | It sets the shape that the child views use for containerRelativeShape, and Spacer takes no child views. |
| Divider | It sets the shape that the child views use for containerRelativeShape, and Divider takes no child views. |
| Button | It sets the shape that the child views use for containerRelativeShape, and Button takes no child views. |
| Toggle | It sets the shape that the child views use for containerRelativeShape, and Toggle takes no child views. |
| Checkbox | It sets the shape that the child views use for containerRelativeShape, and Checkbox takes no child views. |
| Slider | It sets the shape that the child views use for containerRelativeShape, and Slider takes no child views. |
| Picker | It sets the shape that the child views use for containerRelativeShape, and Picker takes no child views. |
| DatePicker | It sets the shape that the child views use for containerRelativeShape, and DatePicker takes no child views. |
| ColorPicker | It sets the shape that the child views use for containerRelativeShape, and ColorPicker takes no child views. |
| Link | It sets the shape that the child views use for containerRelativeShape, and Link takes no child views. |
| Menu | It sets the shape that the child views use for containerRelativeShape, and Menu takes no child views. |
| TextField | It sets the shape that the child views use for containerRelativeShape, and TextField takes no child views. |
| SecureField | It sets the shape that the child views use for containerRelativeShape, and SecureField takes no child views. |
| Text | It sets the shape that the child views use for containerRelativeShape, and Text takes no child views. |
| Label | It sets the shape that the child views use for containerRelativeShape, and Label takes no child views. |
| Image | It sets the shape that the child views use for containerRelativeShape, and Image takes no child views. |
| ProgressView | It sets the shape that the child views use for containerRelativeShape, and ProgressView takes no child views. |
| Gauge | It sets the shape that the child views use for containerRelativeShape, and Gauge takes no child views. |
| AccessoryWidgetBackground | It sets the shape that the child views use for containerRelativeShape, and AccessoryWidgetBackground takes no child views. |
Sources
The original Expo docs for this page:
- containerShape (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)