[Issue-47] Add SystemImage protocol #48
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduction
We have ImageAsset protocol to allow users to load images from asset catalogs, unit test them, and have a fallback image (so that we can return a non-optional UIImage. We should do the same thing for system images, e.g. for UIImage(systemName:) optional initializer.
Purpose
Add a protocol to simplify loading system images from string-based enums.
Fix #47
Scope
Discussion
@WestonHanners mentioned alerting the dev if
loadImage()
fails. Would this beprint
statement? Would it be aLogger
statement? And should we log the message fromloadImage()
or fromimage
? (The former is allowed to returnnil
but the latter is not.) I think it should be fromimage
. Perhaps this would be a separate issue (and the functionality could be added for bothImageAsset
andSystemImage
at the same time.📈 Coverage
Code
100%
Documentation
100%