Class
Button
public final class Button: UIButton
A control that executes your custom code in response to user interactions.
Prefer to use make(style:isCritical:title:icon)
to create a Button.
Relationships
Nested Types
Button.Style
The style of the Button.
Conforms To
UIButton
Initializers
init(style:isCritical:title:icon:)
public init(style: Style = .primary, isCritical: Bool = false, title: String? = nil, icon: UIImage? = nil)
Creates a new Button instance.
Prefer to use make(style:isCritical:title:icon)
instead.
Parameters
Name | Type | Description |
---|---|---|
style | Style |
The style to use for the button. Defaults to .primary. |
isCritical | Bool |
true if the Button should be in the critical state. Defaults to false. |
title | String? |
The title of the button, or nil for no title. |
icon | UIImage? |
The image to place in the button, or nil for no image. |
Properties
iconSide
public var iconSide: LateralDirection = .left
Where the icon should be placed, either on the left of the text, or the right of the text.
isEnabled
public override var isEnabled: Bool
isEnabledPublisher
public var isEnabledPublisher: AnyPublisher<Bool, Never>
isHighlighted
public override var isHighlighted: Bool
Methods
make(style:isCritical:title:icon:)
public static func make(style: Style = .primary, isCritical: Bool = false, title: String? = nil, icon: UIImage? = nil) -> Button
Creates a new Button instance.
Parameters
Name | Type | Description |
---|---|---|
style | Style |
The style to use for the button. Defaults to .primary. |
isCritical | Bool |
true if the Button should be in the critical state. Defaults to false. |
title | String? |
The title of the button, or nil for no title. |
icon | UIImage? |
The image to place in the button, or nil for no image. |
titleRect(forContentRect:)
public override func titleRect(forContentRect contentRect: CGRect) -> CGRect
imageRect(forContentRect:)
public override func imageRect(forContentRect contentRect: CGRect) -> CGRect