EnlightenKeyedSpotlightController

open class EnlightenKeyedSpotlightController<Key> : EnlightenSpotlightController where Key : EnlightenSpotlightControllerKeys

The controller for a spotlight-based onboarding presentation.

Unlike its key-less variant EnlightenSpotlightController, the keyed EnlightenKeyedSpotlightController allows the presentation order of the irises to be specified by the case order of an EnlightenSpotlightControllerKeys-conforming enumeration.

  • The order to present the irises in.

    The dictionary maps Keys to their presentation order index.

    Declaration

    Swift

    public let presentationOrderKeys: [Key : Int]
  • Initializes a new keyed spotlight controller.

    Unlike the key-less variant, the keyed controller allows the presentation order of the irises to be specified.

    Important

    Ensure the only irises added to this keyed spotlight controller are of the type EnlightenKeyedIris.

    Warning

    A fatal error will be thrown if an instance of EnlightenIris is added to a keyed controller.

    Declaration

    Swift

    public init(keys: Key.Type)

    Parameters

    keys

    The type of an enumeration that conforms to the EnlightenSpotlightControllerKeys protocol. The keyed irises will be presented in the order of the enumeration cases.

  • Undocumented

    Declaration

    Swift

    required public init?(coder: NSCoder)
  • Declaration

    Swift

    override open func present(in window: NSWindow? = nil, animating: Bool = false)
  • Declaration

    Swift

    override open func addSpotlight(iris: EnlightenIris)
  • Declaration

    Swift

    override open func addSpotlight(view: NSView, markdownString: String) -> EnlightenIris
  • Declaration

    Swift

    override open func addSpotlight(view: NSView,
                                    markdownFilename: EnlightenIris.MarkdownFilename,
                                    in bundle: Bundle) throws -> EnlightenIris
  • Adds a keyed iris to the controller.

    Declaration

    Swift

    open func addSpotlight(keyedIris: EnlightenKeyedIris<Key>)

    Parameters

    keyedIris

    The keyed iris to add.

  • A convenience method for creating and adding a keyed iris to the controller.

    Important

    Errors thrown during the loading of the Markdown string are passed to the spotlight controller’s delegate’s EnlightenSpotlightControllerDelegate.spotlightControllerFailedToLoad(markdownString:for:with:) method.

    Declaration

    Swift

    @discardableResult
    public func addSpotlight(presentationOrderKey key: Key,
                             view: NSView,
                             markdownString: String) -> EnlightenKeyedIris<Key>

    Parameters

    presentationOrderKey

    The presentation order key for the new keyed iris.

    view

    The view to spotlight.

    markdownString

    The CommonMark Markdown string displayed.

    Return Value

    The newly created spotlight iris.

  • A convenience method for creating and adding a keyed iris to the controller.

    Important

    Errors thrown during the loading of the Markdown string are passed to the spotlight controller’s delegate’s EnlightenSpotlightControllerDelegate.spotlightControllerFailedToLoad(markdownString:for:with:) method.

    Warning

    Asserts the existence of the Markdown file in ‘Debug’ builds, while failing silently in ‘Release’ builds (by returning an empty string).

    Throws

    Throws an error if the contents of the file markdownFilename cannot be read.

    Declaration

    Swift

    @discardableResult
    open func addSpotlight(presentationOrderKey key: Key,
                           view: NSView,
                           markdownFilename: EnlightenIris.MarkdownFilename,
                           in bundle: Bundle) throws -> EnlightenKeyedIris<Key>

    Parameters

    presentationOrderKey

    The presentation order key for the new keyed iris.

    view

    The view to spotlight.

    markdownFilename

    The name of the CommonMark Markdown file in the provided bundle that will be displayed.

    bundle

    The bundle that contains the Markdown file named markdownFilename.

    Return Value

    The newly created spotlight iris.

  • Returns the keyed iris for a view, if it exists.

    Declaration

    Swift

    open func keyedIris(for view: NSView) -> EnlightenKeyedIris<Key>?

    Parameters

    view

    The view to return the keyed iris for.

    Return Value

    The keyed iris for view, or nil if no iris for that view has been added to the controller.

  • Returns the keyed iris for a presentation order key, if it exists.

    Declaration

    Swift

    open func keyedIris(for presentationOrderKey: Key) -> EnlightenKeyedIris<Key>?

    Parameters

    presentationOrderKey

    The presentation order key to return the keyed iris for.

    Return Value

    The keyed iris for presentationOrderKey, or nil if no iris for that key has been added to the controller.