<!--
{
  "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/Shape/role",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ShapeP4roleAA0C4RoleOvpZ"
  },
  "title" : "role"
}
-->

# role

An indication of how to style a shape.

```
nonisolated static var role: ShapeRole { get }
```

## Discussion

SwiftUI looks at a shape’s role when deciding how to apply a
[`ShapeStyle`](/documentation/SwiftUI/ShapeStyle) at render time. The [`Shape`](/documentation/SwiftUI/Shape) protocol provides a
default implementation with a value of [`ShapeRole.fill`](/documentation/SwiftUI/ShapeRole/fill). If you
create a composite shape, you can provide an override of this property
to return another value, if 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)