ArtboardRepresentable

public protocol ArtboardRepresentable

Conform your UIView to this protocol to easily create an Artboard for your example views Provide example views using the artboardElements() method and create an artboard by calling makeArtboard(origin:)

  • The only required method that needs to be implemented Returns vertical stacks of ArtboardElements

    Declaration

    Swift

    static func artboardElements() -> [[ArtboardElement]]
  • name Default implementation

    Name of the artboard.

    Default Implementation

    Defaults to the name of self

    Declaration

    Swift

    static var name: String { get }
  • viewWidth Default implementation

    Fixed width to use for views provided in artboardElements() Set to nil to have the view be self sized

    Default Implementation

    Defaults to the screen width

    Declaration

    Swift

    static var viewWidth: CGFloat? { get }
  • artboardInsets Default implementation

    Insets to the edges of the artboard

    Default Implementation

    Defaults to .zero

    Declaration

    Swift

    static var artboardInsets: UIEdgeInsets { get }
  • artboardSpacing Default implementation

    Spacing between artboard elements

    Default Implementation

    Defaults to 8

    Declaration

    Swift

    static var artboardSpacing: CGFloat { get }
  • artboardColor Default implementation

    Background color of the artboard

    Default Implementation

    Defaults to #F5F5F5

    Declaration

    Swift

    static var artboardColor: Color { get }
  • makeArtboard(origin:) Default implementation

    Generates an Artboard containing examples of the conforming type

    Default Implementation

    Creates an artboard using the elements provided in artboardElements().

    Views provided in artboardElements() will be automatically laid out

    Each set of ArtboardElement will be stacked vertically inside the Artboard

    Declaration

    Swift

    static func makeArtboard(origin: CGPoint) -> Artboard