SystemImage
public protocol SystemImage : 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
).
-
fallbackImage
Default implementationFallback image to use in case a system image cannot be loaded.
Default Implementation
Returns a 16 x 16 square filled with
.systemPink
.Declaration
Swift
static var fallbackImage: UIImage { get }
-
image
Default implementationA system image for this name value.
Default Implementation
Returns
loadImage()
nil-coalesced tofallbackImage
.Declaration
Swift
var image: UIImage { get }
-
textStyle
Default implementationImage will scale according to the specified text style.
Return
nil
to not have the system image scale (not recommended).Default Implementation
Returns
.body
text style.Declaration
Swift
static var textStyle: UIFont.TextStyle? { get }
-
configuration
Default implementationImage configuration to be used to load the system image.
Default Implementation
Returns
UIImage.SymbolConfiguration(textStyle:)
passing in the specifiedtextStyle
or else returnsnil
iftextStyle
isnil
.Declaration
Swift
static var configuration: UIImage.Configuration? { get }
-
renderingMode
Default implementationRendering mode to use for the system image.
Default Implementation
Returns
.automatic
rendering mode.Declaration
Swift
static var renderingMode: UIImage.RenderingMode { get }
-
loadImage()
Default implementationLoads the named system image.
Default Implementation
Returns
UIImage(systemName:)
passing in the associatedrawValue
andconfiguration
and combined with the specifiedrenderingMode
.Declaration
Swift
func loadImage() -> UIImage?
Return Value
The named system image or else
nil
if the system image cannot be loaded.