FocusMonitor

@available(iOS 11.0, tvOS 11.0, *)
public class FocusMonitor : BaseNotificationMonitor

A FocusMonitor instance monitors the app for changes to the current focus in the view hierarchy.

  • Encapsulates changes to the focus in the app’s view hierarchy.

    See more

    Declaration

    Swift

    public enum Event
  • Encapsulates information associated with a focus monitor event.

    See more

    Declaration

    Swift

    public struct Info
  • Specifies which events to monitor.

    See more

    Declaration

    Swift

    public struct Options : OptionSet
  • Initializes a new FocusMonitor.

    Declaration

    Swift

    public init(options: Options = .all,
                queue: OperationQueue = .main,
                handler: @escaping (Event) -> Void)

    Parameters

    options

    The options that specify which events to monitor. By default, all events are monitored.

    queue

    The operation queue on which the handler executes. By default, the main operation queue is used.

    handler

    The handler to call when the current focus is updated or cannot be moved in the selected direction.

  • Declaration

    Swift

    override public func addNotificationObservers()