focusable(_:onFocusChange:)
Specifies if the view is focusable and, if so, adds an action to perform when the view comes into focus.
Declaration
nonisolated func focusable(_ isFocusable: Bool = true, onFocusChange: @escaping (Bool) -> Void = { _ in }) -> some View
Parameters
- isFocusable:
A Boolean value that indicates whether this view is focusable.
- onFocusChange:
A closure that’s called whenever this view either gains or loses focus. The Boolean parameter to
onFocusChangeistruewhen the view is in focus; otherwise, it’sfalse.
Return Value
A view that sets whether a view is focusable, and triggers onFocusChange when the view gains or loses focus.
See Also
Input and events modifiers
onChange(of:perform:)onTapGesture(count:coordinateSpace:perform:)onLongPressGesture(minimumDuration:maximumDistance:pressing:perform:)onLongPressGesture(minimumDuration:pressing:perform:)onPasteCommand(of:perform:)onPasteCommand(of:validator:perform:)onDrop(of:delegate:)onDrop(of:isTargeted:perform:)onContinuousHover(coordinateSpace:perform:)