Protocols

The following protocols are available globally.

  • Anything that exposes layout anchors. In our use this will be UIView and UILayoutGuide. This abstracts away the differences between them such that we can pass either a view or a layout guide to our constrain methods that act upon anchors.

    See more

    Declaration

    Swift

    public protocol Anchorable
  • Any named color asset that can be loaded from an asset catalog (primarily for use with string-based enums).

    All properties and functions have default implementations. At a minimum just have your string-based enum conform to Colorable (and have an asset catalog with matching assets). If your enum and assets live inside a Swift package, override bundle to return .module. If your assets are categorized within their asset catalog by a namespace, then override namespace to return the proper string prefix.

    See more

    Declaration

    Swift

    public protocol Colorable : RawRepresentable where Self.RawValue == String
  • Any named image asset can be loaded from an asset catalog.

    All properties and functions have default implementations. At a minimum just have your string-based enum conform to ImageAsset (and have an asset catalog with matching assets). If your enum and assets live inside a Swift package, override bundle to return .module. If your assets are categorized within their asset catalog by a namespace, then override namespace to return the proper string prefix.

    See more

    Declaration

    Swift

    public protocol ImageAsset : RawRepresentable where Self.RawValue == String
  • Any string resource that can be localized (primarily for use with string-based enums)

    See more

    Declaration

    Swift

    public protocol Localizable : RawRepresentable where Self.RawValue == String
  • Any string corresponding to a system image (SF Symbols).

    All properties and functions have default implementations. At a minimum just have your string-based enum conform to SystemImage. The raw value of the enum should match a sytem image name (e.g. checkmark.seal).

    See more

    Declaration

    Swift

    public protocol SystemImage : RawRepresentable where Self.RawValue == String