//
//  Bundle+.swift
//  YTBase_Example
//
//  Created by YouT on 2020/9/16.
//  Copyright © 2020 CocoaPods. All rights reserved.
//

import UIKit

public extension Bundle {
    class func getImage(bundleName: String, nameed:String) -> UIImage? {
        if let theBundlePath = Bundle.path(forResource: bundleName, ofType: "bundle", inDirectory: Bundle.main.bundlePath),
            let theBundle = Bundle(path: theBundlePath),
            let filePath = theBundle.path(forResource: nameed, ofType: "png") {
            return UIImage(contentsOfFile: filePath)
        }
        return nil
    }
    
    class func getImage(in theBundle: Bundle, nameed:String) -> UIImage? {
        guard let filePath = theBundle.path(forResource: nameed, ofType: "png") else { return nil }
        return UIImage(contentsOfFile: filePath)
    }
    
}
