---
title: "beginTracking(_:with:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicontrol/begintracking(_:with:)"
---

# beginTracking(_:with:)

Notifies the control when a touch event enters the control’s bounds.

## Declaration

```swift
func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool
```

## Parameters

- `touch`: The object containing information about the touch event.
- `event`: The event object containing the touch event.

## Return Value

Return Value true if the control should continue tracking touch events or false if it should stop. This value is used to update the isTracking property of the control.

## Discussion

Discussion The default implementation of this method always returns true. Subclasses can override this method and use it to respond to events. Use the provided event information to detect which part of your control was hit and to set up any initial state information. If you want to continue tracking the touch event, return true. If you want to stop tracking the touch event, return false.

## See Also

### Tracking touches and redrawing controls

- [continueTracking(_:with:)](uikit/uicontrol/continuetracking(_:with:).md)
- [endTracking(_:with:)](uikit/uicontrol/endtracking(_:with:).md)
- [cancelTracking(with:)](uikit/uicontrol/canceltracking(with:).md)
- [isTracking](uikit/uicontrol/istracking.md)
- [isTouchInside](uikit/uicontrol/istouchinside.md)
