FocusManageable

public protocol FocusManageable : AnyObject

A FocusManager takes requests to acquire and release Channels and updates the focuses of other Channels based on their priorities so that the invariant that there can only be one Foreground Channel is held.

  • The object that acts as the delegate of focus-manager

    Declaration

    Swift

    var delegate: FocusDelegate? { get set }
  • Register FocusChannelDelegate to FocusManager.

    Declaration

    Swift

    func add(channelDelegate: FocusChannelDelegate)

    Parameters

    channelDelegate

    The object to register.

  • Unregister FocusChannelDelegate from FocusManager.

    Declaration

    Swift

    func remove(channelDelegate: FocusChannelDelegate)

    Parameters

    channelDelegate

    The object to unregister.

  • This method will acquire the channel and prepare focus to it.

    The caller will be notified via an focusChannelDidChange:focusState:

    Declaration

    Swift

    func prepareFocus(channelDelegate: FocusChannelDelegate)

    Parameters

    channelDelegate

    The object to prepare focus.

  • This method will release the prepared channel.

    The caller will be notified via an focusChannelDidChange:focusState: If the Channel to release is the current foreground focused Channel, it will also notify the next highest priority Channel via an focusChannelDidChange:focusState: callback that it has gained foreground focus.

    Declaration

    Swift

    func cancelFocus(channelDelegate: FocusChannelDelegate)

    Parameters

    channelDelegate

    The object to release focus.

  • This method will acquire the channel and grant the appropriate focus to it and other channels if needed.

    The caller will be notified via an focusChannelDidChange:focusState: If the Channel was already held by a different observer, the observer will be notified via focusChannelDidChange:focusState: to stop before letting the new observer start.

    Declaration

    Swift

    func requestFocus(channelDelegate: FocusChannelDelegate)

    Parameters

    channelDelegate

    The object to request focus.

  • This method will release the Channel and notify the observer of the Channel.

    The caller will be notified via an focusChannelDidChange:focusState: If the Channel to release is the current foreground focused Channel, it will also notify the next highest priority Channel via an focusChannelDidChange:focusState: callback that it has gained foreground focus.

    Declaration

    Swift

    func releaseFocus(channelDelegate: FocusChannelDelegate)

    Parameters

    channelDelegate

    The object to release focus.