DSIconButton
@IBDesignable
public final class DSIconButton : UIButton
An Anatomy-styled, image-only push button element that displays an icon as well as all normal UIButton functionality. Title text is not allowed.
For storyboards, add a UIButton to your view and change the class name to DSIconButton. BE SURE THE TYPE IS SET TO CUSTOM otherwise some colors won’t show correctly.
If the button performs an asynchronous operation, you can present a spinning indicator by setting isLoading to true. This will also disable the button.
Initialize and set properties as needed.
let button = DSIconButton(icon: .gear)
-
An Anatomy icon to display on the button.
Declaration
Swift
public var icon: DSIconRenderingType? { get set }
-
The icon property representable by a String.
This property is only recommended for use in the Attributes inspector of a storyboard since enums are not @IBInspectable. Possible values are left and right. In code, use the icon property instead.
Declaration
Swift
@IBInspectable public var iconString: String? { get set }
-
When set to true, the button contents disappear and are replaced by a spinning indicator. The button will also become disabled. Use this when you want to keep the user from tapping the button during an asyncronous activity for example.
Declaration
Swift
public var isLoading: Bool { get set }
-
Initializes and returns a newly allocated Button with the specified icon.
Declaration
Swift
public init(icon: DSIconRenderingType)
Parameters
icon
The icon for DSIconButton. Can be changed after initialization as well.