<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/LayoutSubview/priority",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13LayoutSubviewV8prioritySdvp"
  },
  "title" : "priority"
}
-->

# priority

The layout priority of the subview.

```
var priority: Double { get }
```

## Discussion

If you define a custom layout type using the [`Layout`](/documentation/SwiftUI/Layout)
protocol, you can read this value from subviews and use the value
when deciding how to assign space to subviews. For example, you
can read all of the subview priorities into an array before
placing the subviews in a custom layout type called `BasicVStack`:

```
extension BasicVStack {
    func placeSubviews(
        in bounds: CGRect,
        proposal: ProposedViewSize,
        subviews: Subviews,
        cache: inout ()
    ) {
        let priorities = subviews.map { subview in
            subview.priority
        }

        // Place views, based on priorities.
    }
}
```

Set the layout priority for a view that appears in your layout by
applying the [`layoutPriority(_:)`](/documentation/SwiftUI/View/layoutPriority(_:)) view modifier. For example,
you can assign two different priorities to views that you arrange
with `BasicVStack`:

```
BasicVStack {
    Text("High priority")
        .layoutPriority(10)
    Text("Low priority")
        .layoutPriority(1)
}
```

---

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)