IconSelector
@available(iOSApplicationExtension, unavailable)
public class IconSelector : UIControl, UIGestureRecognizerDelegate
A control that presents available icons and allows selection.
This control will not actually perform any updates based on the user’s selection. It is the responsibility of
the parent UIViewController
to perform the update. There are two methods to perform the actual updates.
- Read the
selectedIcon
upon the user indicating they’re done. - Use
addTarget(_:action:for:)
to enroll in updates for the.valueChanged
event.
-
Undocumented
Declaration
Swift
public let icons: [Icon]
-
Creates an
IconSelector
in the given frame, with the given icons.Declaration
Swift
public init(frame: CGRect, icons: [Icon])
Parameters
frame
Frame to put this control within
icons
Icons to display
-
Creates an
IconSelector
in the given frame, with the givenBundle
.Declaration
Swift
public convenience init(frame: CGRect, bundle: Bundle = .main)
Parameters
frame
Frame to put this control within
bundle
Bundle
to pull icons from; defaults to themain
bundle. -
Creates an
IconSelector
with the given iconsDeclaration
Swift
public convenience init(icons: [Icon])
Parameters
icons
Icons to display
-
Creates an
IconSelector
for the givenBundle
Declaration
Swift
public convenience init(bundle: Bundle = .main)
Parameters
bundle
Bundle
to load the icons from; defaults to themain
bundle. -
Undocumented
Declaration
Swift
public override func didMoveToSuperview()
-
Gets the currently selected icon.
Declaration
Swift
public var selectedIcon: Icon? { get set }
-
Undocumented
Declaration
Swift
override public var isEnabled: Bool { get set }
-
Undocumented
Declaration
Swift
override public var layoutMargins: UIEdgeInsets { get set }
-
Undocumented
Declaration
Swift
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool
-
Gets or sets the size of the icons to display
Declaration
Swift
public var iconSize: CGFloat { get set }
-
Gets or sets the width of the selection stroke
Declaration
Swift
public var selectionStrokeWidth: CGFloat { get set }
-
Gets or sets the stroke color for unselected icons
Declaration
Swift
public var unselectedStrokeColor: UIColor? { get set }
-
Flag to indicate if icon labels should be displayed. Defaults to
false
.Declaration
Swift
public var shouldDisplayLabels: Bool { get set }
-
Flag to indicate if the icons are lined up with the leading and trailing edges of the
IconSelector
view.When
true
, the spacing between the horizontal edges of the parent view is fixed, pinning the respective edges of the icons within the first and last columns to theIconSelector
view. This is useful when lining the horizontal edges of theIconSelector
up with other edges, such as displaying within a table view, as the visual edges are fixed.When
false
the spacing between the horizontal edges of the parent view is flexible, and sized to match the space between the icons themselves. This is useful when pinning theIconSelector
itself to the edges of the device’s screen, as it ensures even spacing for the icons, replicating the look of the iOS springboard layout.Note
The width of icon labels (if enabled) cannot exceed the width of the icons themselves if this setting is enabled, and will be truncated as required. If edges are not anchored, icon labels can fill the available space as needed, similar to how they would be displayed on the iOS springboard.Declaration
Swift
public var anchorHorizontalEdges: Bool { get set }
-
Gets or sets a flag to have this control adjust its height to fit the content it is displaying.
Declaration
Swift
public var adjustHeightToFitContent: Bool { get set }
-
Undocumented
Declaration
Swift
override public func layoutSubviews()
-
Undocumented
Declaration
Swift
override public func updateConstraints()