View ModifieriOS 15.0+macOS 12.0+tvOS 15.0+watchOS 8.0+
Overloads
2 ways to call compose().dynamicTypeSize(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().dynamicTypeSize(size: SwiftUI.DynamicTypeSize)nonisolated func dynamicTypeSize(_ size: DynamicTypeSize) -> some ViewParameters
The size to set for this view.
Return value
A view that sets the Dynamic Type size to the specified size.
Discussion
As an example, you can set a Dynamic Type size in ContentView to be
DynamicTypeSize.xLarge (this can be useful in previews to see your
content at a different size) like this:
ContentView()
.dynamicTypeSize(.xLarge)If a Dynamic Type size range is applied after setting a value, the value is limited by that range:
ContentView() // Dynamic Type size will be .large
.dynamicTypeSize(...DynamicTypeSize.large)
.dynamicTypeSize(.xLarge)When limiting the Dynamic Type size, consider if adding a
large content view with View.accessibilityShowsLargeContentViewer()
would be appropriate.
See also
More in Layout.
- alignmentGuideSets the view's vertical alignment.
- aspectRatioConstrains this view's dimensions to the specified aspect ratio.
- containerCornerOffsetAdjusts the view's layout to avoid the container view's corner insets for the specified edges.
- containerRelativeFramePositions this view within an invisible frame with a size relative to the nearest container.
- controlSizeSets the size for controls within this view.
- defaultScrollAnchorAssociates an anchor to control which part of the scroll view's content should be rendered by default.
- fixedSizeFixes this view at its ideal size.
- flipsForRightToLeftLayoutDirectionSets whether this view mirrors its contents horizontally when the layout direction is right-to-left.
- framePositions this view within an invisible frame.
- geometryGroupIsolates the geometry (e.g. position and size) of the view from its parent view.
- gridCellAnchorSpecifies a custom alignment anchor for a view that acts as a grid cell.
- gridCellColumnsTells a view that acts as a cell in a grid to span the specified number of columns.