UIViewStyle

open class UIViewStyle<T> where T : UIView

An abstraction if UIView styling.

Important

This is a Public Preview API. It may be changed or removed at any time.

Lifecycle

  • Initialization method

    Declaration

    Swift

    public init(styling: @escaping (T) -> ())

    Parameters

    styling

    The styling function that takes a UIView instance

Public

  • The styling function that takes a UIView instance and performs side-effects on it.

    Declaration

    Swift

    public let styling: (T) -> ()
  • A factory method that composes multiple styles.

    Declaration

    Swift

    public static func compose(_ styles: UIViewStyle<T>...) -> UIViewStyle<T>

    Parameters

    styles

    The styles to compose.

    Return Value

    A new UIViewStyle that will call the input styles’ styling method in succession.

  • Compose this style with another.

    Declaration

    Swift

    public func composing(with other: UIViewStyle<T>) -> UIViewStyle<T>

    Parameters

    other

    Other style to compose this style with.

    Return Value

    A new UIViewStyle which will call this style’s styling, and then the other style’s styling.

  • Compose this style with another styling function.

    Declaration

    Swift

    public func composing(with otherStyling: @escaping (T) -> ()) -> UIViewStyle<T>

    Parameters

    otherStyling

    The function to compose this style with.

    Return Value

    A new UIViewStyle which will call this style’s styling, and then the input styling.

  • Apply this style to a UIView.

    Declaration

    Swift

    public func apply(to view: T)

    Parameters

    view

    the view to style

  • Apply this style to multiple views.

    Declaration

    Swift

    public func apply(to views: T...)

    Parameters

    views

    the views to style