Link Search Menu Expand Document

FocusEnvironment

A set of methods that define the focus behavior for a branch of the view hierarchy.

public protocol FocusEnvironment: AnyObject 

Inheritance

AnyObject

Default Implementations

soundIdentifierForFocusUpdate(in:)

public func soundIdentifierForFocusUpdate(in context: FocusUpdateContext)
      -> FocusSoundIdentifier? 

focusGroupIdentifier

public var focusGroupIdentifier: String? 

Requirements

setNeedsFocusUpdate()

Submits a request to the focus engine for a focus update in this environment.

func setNeedsFocusUpdate()

updateFocusIfNeeded()

Tells the focus engine to force a focus update immediately.

func updateFocusIfNeeded()

shouldUpdateFocus(in:​)

Returns a boolean value indicating whether the focus engine should allow the focus update described by the specified context to occur.

func shouldUpdateFocus(in context: FocusUpdateContext) -> Bool

didUpdateFocus(in:​with:​)

Called immediately after the system updates the focus to a new view.

func didUpdateFocus(in context: FocusUpdateContext,
                      with coordinator: FocusAnimationCoordinator)

preferredFocusEnvironments

An array of focus environments, ordered by priority, to which this environment prefers focus to be directed during a focus update.

var preferredFocusEnvironments: [FocusEnvironment] 

soundIdentifierForFocusUpdate(in:​)

Asks the delegate for the identifier of the sound to play when the object gains focus.

func soundIdentifierForFocusUpdate(in context: FocusUpdateContext)
      -> FocusSoundIdentifier?

contains(_:​)

Returns a boolean value indicating whether the focus environment contains the specified environment.

func contains(_ environment: FocusEnvironment) -> Bool

parentFocusEnvironment

The parent focus environment for this environment.

var parentFocusEnvironment: FocusEnvironment? 

focusItemContainer

The container for the child focus items in this focus environment.

var focusItemContainer: FocusItemContainer? 

focusGroupIdentifier

var focusGroupIdentifier: String?