jsdw_ios/QuickLocation/Core/Extension/UIImage+Resource.swift

21 lines
462 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// UIImage+Resource.swift
// QuickLocation
//
import UIKit
extension UIImage {
/// Resources Assets.xcassets
static func resource(_ name: String) -> UIImage? {
if let assetImg = UIImage(named: name) {
return assetImg
}
guard let path = Bundle.main.path(forResource: name, ofType: nil) else {
return nil
}
return UIImage(contentsOfFile: path)
}
}