Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SixFiveSoftware/7b34649542280c051bb4ac5c75b9ba08 to your computer and use it in GitHub Desktop.
Save SixFiveSoftware/7b34649542280c051bb4ac5c75b9ba08 to your computer and use it in GitHub Desktop.
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