Skip to content

Expand SystemImage protocol to load scalable system images by default #50

Closed
@mpospese

Description

@mpospese

Our SystemImage protocol should load scalable system images by default. We do that by loading the image with UIImage.SymbolConfiguration(textStyle: aTextStyle). This allows the image scale according to the specified text style when Dynamic Type changes. And it will respond to Bold Text as well (to use heavier strokes).

  1. add a static var textStyle: UIFont.TextStyle? with default implementation = .body
  2. add a static var configuration: UIImage.Configuration with default implementation = UIImage.SymbolConfiguration(textStyle: textStyle) when textStyle != nil (need to see what configuration to use when it's nil. Maybe nil or maybe some default configuration that does nothing)

Idea is the following:

  1. By default system images will scale according to .body
  2. It's simple to override and specify a different text style if you need it a bit bigger or smaller; e.g. callout or title
  3. If needed you can also provide any configuration. e.g. in addition to textStyle you might also want to configure weight (e.g. ultralight or bold) to adjust the appearance of the symbol. It's also an opportunity to apply hierarchical or palette information.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions