Button
public struct Button : View
Wrapper of UIButton A control that executes your custom code in response to user interactions.
Button {
// click action
} builder: {
// content
}
-
The node behind the button.
Declaration
Swift
public var node: ArgoKitNode? { get } -
Initializer
Declaration
Swift
public init(action: @escaping () -> Void, @ArgoKitViewBuilder builder: @escaping () -> View)Parameters
actionThe action to perform when the user triggers the button.
builderA view builder that creates the content of this button.
-
Initializer
Declaration
Swift
public init(text: @autoclosure @escaping () -> String?, action: @escaping () -> Void)Parameters
textA string that describes the purpose of the button’s action.
actionThe action to perform when the user triggers the button.
-
Sets the color of the text.
Declaration
Swift
@discardableResult public func textColor(_ color: @autoclosure @escaping () -> UIColor?) -> ButtonParameters
colorThe color of the text.
Return Value
self
-
Sets the font of the text.
Declaration
Swift
@discardableResult public func font(_ value: @autoclosure @escaping () -> UIFont) -> ButtonParameters
valueThe font of the text.
Return Value
self
-
Sets the font of the text.
Declaration
Swift
@discardableResult public func font(name: @autoclosure @escaping () -> String? = nil, style: @autoclosure @escaping () -> AKFontStyle = .default, size: @autoclosure @escaping () -> CGFloat) -> ButtonParameters
nameThe fully specified name of the font. This name incorporates both the font family name and the specific style information for the font.
styleThe text style for which to return a font. See AKFontStyle for recognized values.
sizeThe size (in points) to which the font is scaled. This value must be greater than 0.0.
Return Value
self
-
Sets the color of the text.
Declaration
Swift
@discardableResult public func textColor(red r: @autoclosure @escaping () -> Int, green g: @autoclosure @escaping () -> Int, blue b: @autoclosure @escaping () -> Int, alpha a: @autoclosure @escaping () -> CGFloat = 1) -> ButtonParameters
rThe red value of the color object. 0~255
gThe green value of the color object. 0~255
bThe blue value of the color object. 0~255
aThe opacity value of the color object. 0.0~1.0
Return Value
self
-
Sets the color of the text.
Declaration
Swift
@discardableResult public func textColor(hex: @autoclosure @escaping () -> Int, alpha a: @autoclosure @escaping () -> Float = 1) -> ButtonParameters
hexThe hex value of the color object
aThe opacity value of the color object. 0.0~1.0
Return Value
self
-
Sets the background image to use for the specified button state.
Declaration
Swift
@discardableResult public func backgroundImage(image: @autoclosure @escaping () -> UIImage?, for state: @autoclosure @escaping () -> UIControl.State) -> ButtonParameters
imageThe background image to use for the specified state.
stateThe state that uses the specified image. The values are described in UIControl.State.
Return Value
self
-
Sets the background image to use for the specified button state.
Declaration
Swift
@discardableResult public func backgroundImage(named name: @autoclosure @escaping () -> String?, for state: @autoclosure @escaping () -> UIControl.State) -> ButtonParameters
nameThe name of the image asset or file. For images in asset catalogs, specify the name of the image asset. For PNG images, you may omit the filename extension. For all other file formats, always include the filename extension.
stateThe state that uses the specified image. The values are described in UIControl.State.
Return Value
self
Button Structure Reference