---
title: "pointerStyle(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/pointerstyle(_:)"
---

# pointerStyle(_:)

Sets the pointer style to display when the pointer is over the view.

## Declaration

```swift
nonisolated func pointerStyle(_ style: PointerStyle?) -> some View

```

## Parameters

- `style`: The pointer style to use.

## Return Value

Return Value A view that changes the style of the pointer when hovered.

## Discussion

Discussion Refer to PointerStyle for a list of available pointer styles. For guidance on choosing an appropriate pointer style, refer to Pointing devices in the Human Interface Guidelines. In this example, the pointer style indicates rectangular selection is possible while the Option modifier key is pressed: enum ToolMode {     // ...     case selection }

struct ImageEditorView: View {     @State private var toolMode?

var body: some View {         ImageCanvasView()             .pointerStyle(                 toolMode == .selection ? .rectSelection : nil)             .onModifierKeysChanged { _, modifierKeys in                 if modifierKeys.contains(.option) {                     toolMode = .selection                 } else {                     toolMode = nil                 }             }     } }

## See Also

### Modifying pointer appearance

- [PointerStyle](swiftui/pointerstyle.md)
- [pointerVisibility(_:)](swiftui/view/pointervisibility(_:).md)
