<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/dynamicTypeSize(_:)-1m2tf",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE15dynamicTypeSizeyQrAA07DynamiceF0OF"
  },
  "title" : "dynamicTypeSize(_:)"
}
-->

# dynamicTypeSize(_:)

Sets the Dynamic Type size within the view to the given value.

```
nonisolated func dynamicTypeSize(_ size: DynamicTypeSize) -> some View
```

## Parameters

`size`

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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)