Created
March 16, 2020 19:16
-
-
Save MitchellMalleo/6e21468ed80051f2b668e1bd9a0ef7a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ImageConvertible where Self: RawRepresentable, Self.RawValue == String { | |
var image: UIImage? { | |
return UIImage(named: self.rawValue) | |
} | |
} | |
extension UIImage { | |
convenience init?<T: RawRepresentable>(image: T) where T.RawValue == String { | |
self.init(named: image.rawValue) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment