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 implementationName of the artboard.
Default Implementation
Defaults to the name of self
Declaration
Swift
static var name: String { get }
-
viewWidth
Default implementationFixed 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 implementationInsets to the edges of the artboard
Default Implementation
Defaults to .zero
Declaration
Swift
static var artboardInsets: UIEdgeInsets { get }
-
artboardSpacing
Default implementationSpacing between artboard elements
Default Implementation
Defaults to 8
Declaration
Swift
static var artboardSpacing: CGFloat { get }
-
artboardColor
Default implementationBackground color of the artboard
Default Implementation
Defaults to #F5F5F5
Declaration
Swift
static var artboardColor: Color { get }
-
makeArtboard(origin:)
Default implementationGenerates an
Artboard
containing examples of the conforming typeDefault Implementation
Creates an artboard using the elements provided in
artboardElements()
.Views provided in
artboardElements()
will be automatically laid outEach set of
ArtboardElement
will be stacked vertically inside theArtboard
Declaration
Swift
static func makeArtboard(origin: CGPoint) -> Artboard