Forked from MitchellMalleo/gist:6e21468ed80051f2b668e1bd9a0ef7a0
Created
March 31, 2020 20:03
-
-
Save SixFiveSoftware/7b34649542280c051bb4ac5c75b9ba08 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