Skip to content

Instantly share code, notes, and snippets.

@RameshAran
Last active July 30, 2017 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RameshAran/96542a0edad03a7342d48e52e1c52763 to your computer and use it in GitHub Desktop.
Save RameshAran/96542a0edad03a7342d48e52e1c52763 to your computer and use it in GitHub Desktop.
import UIKit
enum AssetIdentifier: String {
case ImageIconOne = "icon_image_1"
case ImageIconTwo = "icon_image_2"
case ImageIconThree = "icon_image_3"
}
extension UIImage {
convenience init!(assetIdentifier: AssetIdentifier) {
self.init(named: assetIdentifier.rawValue)
}
}
@RameshAran
Copy link
Author

Reference:-
WWDC video, Swift In Practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment