Components
Icon-only button used to perform actions.
IconButton should be used for interactive elements which do not contain text like a usual Button.
Icon buttons are required to have a non-empty accessibility label to ensure that VoiceOver and the Large Content Viewer can provide users with a helpful description of their purpose.
UIAccessibilityTraits.button is added to all icon buttons. Additionally, UIAccessibilityTraits.selected / UIAccessibilityTraits.notEnabled are added when the button is in the selected or disabled state, respectively.
In iOS 13.0+, icon buttons support the Large Content Viewer–users who set one a large text sizes for accessibility can long press on an icon button to see a HUD with the icon button’s icon enlarged as well as a label with the button’s accessibility label. No action is required to enable this functionality–it is added automatically.
As with all Thumbprint controls, icon buttons will always have a minimum tap target of 48x48 points, independent of the button’s frame. This does not affect the visual layout of the button–it purely affects the size of the area around the button that captures touches.
public let tintColor: UIColorDefault tint color for button’s icon.
public let activeTintColor: UIColorTint color for button’s icon in highlighted and selected states.
public let disabledTintColor: UIColorTint color for button’s icon in disabled state.
public init(tintColor: UIColor, activeTintColor: UIColor, disabledTintColor: UIColor)Creates and returns a custom theme.
public static let default: IconButton.ThemeDefault theme for use on a light background.
public static let dark: IconButton.ThemeTheme for use on a dark background.
public private(set) var icon: UIImageIcon to be displayed. To set this property, use setIcon(_:accessibilityLabel:theme:).
public private(set) var theme: ThemeIcon button’s theme. To set this property, use setIcon(_:accessibilityLabel:theme:).
public var contentEdgeInsets: UIEdgeInsetsSet padding around the icon.
public func setIcon(_ icon: UIImage, accessibilityLabel: String, theme: IconButton.Theme = .default)Update the icon, accessibility label, and/or theme of this button. The accessibility label must not be an empty string.
public init(icon: UIImage, accessibilityLabel: String, theme: IconButton.Theme = .default)Creates and returns an icon button with the specified icon, accessibility label, and theme. The accessibility label must not be an empty string.