---
title: UIButton.PointerStyleProvider
framework: uikit
role: symbol
role_heading: Type Alias
path: uikit/uibutton/pointerstyleprovider-swift.typealias
---

# UIButton.PointerStyleProvider

A type alias defining a closure that returns a pointer style to apply to a button.

## Declaration

```swift
typealias PointerStyleProvider = (UIButton, UIPointerEffect, UIPointerShape) -> UIPointerStyle?
```

## Parameters

- `button`: The button requesting the pointer style.
- `proposedEffect`: The content effect that the system suggests.
- `proposedShape`: The shape of the pointer that the system suggests.

## Return Value

Return Value The pointer style to apply to the button when the pointer hovers over it. Return nil when you don’t want to apply a pointer style to the button.

## Discussion

Discussion To change the appearance of the pointer when it hovers over the button, create a pointer style provider closure and assign it to the button’s pointerStyleProvider property. For instance, the following code listing increases the size of the pointer, while keeping the proposed content effect, to provide better highlighting of the button when the pointer hovers over it. straightLineModeButton?.pointerStyleProvider = { button, proposedEffect, proposedShape -> UIPointerStyle? in     var rect = button.bounds.insetBy(dx: -12.0, dy: -14.0)     rect = button.convert(rect, to: proposedEffect.preview.target.container)     return UIPointerStyle(effect: proposedEffect, shape: .roundedRect(rect)) }

## See Also

### Supporting pointer interactions

- [isPointerInteractionEnabled](uikit/uibutton/ispointerinteractionenabled.md)
- [isHovered](uikit/uibutton/ishovered.md)
- [pointerStyleProvider](uikit/uibutton/pointerstyleprovider-y4eb.md)
- [UIButtonPointerStyleProvider](uikit/uibuttonpointerstyleprovider.md)
