---
title: hasFocus
framework: xcuiautomation
role: symbol
role_heading: Instance Property
path: xcuiautomation/xcuielementattributes/hasfocus
---

# hasFocus

The property that determines whether the element has UI focus.

## Declaration

```swift
var hasFocus: Bool { get }
```

## See Also

### Interaction state

- [isEnabled](xcuiautomation/xcuielementattributes/isenabled.md)
- [isSelected](xcuiautomation/xcuielementattributes/isselected.md)
