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
See moreconstrain
methods that act upon anchors.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
See moreColorable
(and have an asset catalog with matching assets). If your enum and assets live inside a Swift package, overridebundle
to return.module
. If your assets are categorized within their asset catalog by a namespace, then overridenamespace
to return the proper string prefix.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
See moreImageAsset
(and have an asset catalog with matching assets). If your enum and assets live inside a Swift package, overridebundle
to return.module
. If your assets are categorized within their asset catalog by a namespace, then overridenamespace
to return the proper string prefix.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 moreDeclaration
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
See moreSystemImage
. The raw value of the enum should match a sytem image name (e.g.checkmark.seal
).Declaration
Swift
public protocol SystemImage : RawRepresentable where Self.RawValue == String