IconSelectorViewController

@available(iOSApplicationExtension, unavailable)
open class IconSelectorViewController : UITableViewController

A very simple view controller implementation of the IconSelector, which can be instantiated to display a custom collection of icons, or pull the complete list from a given bundle.

  • The icons displayed by the receiver.

    Declaration

    Swift

    public let icons: [Icon]
  • Creates an IconSelectorViewController with the given icons.

    Declaration

    Swift

    public init(icons: [Icon])

    Parameters

    icons

    Icons to display

  • Creates an IconSelectorViewController with icons from the given bundle. Icons should be defined within the CFBundleIcons value of the given bundle‘s Info.plist.

    Declaration

    Swift

    public convenience init(bundle: Bundle = .main)

    Parameters

    bundle

    The Bundle to source icons from. Defaults to the main bundle.

  • Undocumented

    Declaration

    Swift

    public required convenience init?(coder: NSCoder)

View life cycle

  • Returns the icon selector managed by the controller object.

    Declaration

    Swift

    public var iconSelector: IconSelector? { get }
  • Undocumented

    Declaration

    Swift

    public override func loadView()

Responding to selection

  • Method called when the icon is selected within the view controller.

    Note

    The default implementation validates that alternate icons are supported, and that the application is in an active state before attempting to change the selected icon. If the application is not in an active state, the application will loop until it is.

    Declaration

    Swift

    open func iconSelector(_ iconSelector: IconSelector, didChangeValue selectedIcon: Icon)

    Parameters

    iconSelector

    The IconSelector that the selectedIcon was selected in.

    selectedIcon

    The Icon that was selected.

  • Method called when the application throws an error upon attempting to select an icon.

    Note

    The default implementation does nothing, which is a mostly valid option. The only errors really thrown are to indicate that an invalid icon was selected, so as long as the icons you provide during init are sourced from the Info.plist (the default option), you’re golden.

    Declaration

    Swift

    open func iconSelector(_ iconSelector: IconSelector, didFailWith error: Swift.Error)

    Parameters

    iconSelector

    The IconSelector that the selectedIcon was selected in.

    error

    The Error that was thrown by the system.