I am trying to make my code safer using Enums and a connivence initializer when dealing with UIImage and the Asset Catalog. My code is here below.
import UIKit
extension UIImage {
enum AssetIdentifier: String {
case Search = "Search"
case Menu = "Menu"
}
convenience init(assetIdentifier: AssetIdentifier) {
self.init(named: AssetIdentifier.RawValue)
}
}
Currently I am getting this error.
'Cannot invoke 'UIImage.init' with an argument of type '(named: RawValue.Type)'