File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,22 @@ import Foundation
22import UIKit
33import Photos
44
5+ extension Bundle {
6+ static func myResourceBundle( ) -> Bundle ? {
7+ let bundles = Bundle . allBundles
8+ let bundlePaths = bundles. compactMap { $0. resourceURL? . appendingPathComponent ( " ImagePicker " , isDirectory: false ) . appendingPathExtension ( " bundle " ) }
9+
10+ return bundlePaths. compactMap ( { Bundle ( url: $0) } ) . first
11+ }
12+ }
13+
514open class AssetManager {
615
716 public static func getImage( _ name: String ) -> UIImage {
817 let traitCollection = UITraitCollection ( displayScale: 3 )
9- var bundle = Bundle ( for : AssetManager . self )
18+ var bundle = Bundle . myResourceBundle ( )
1019
11- if let resource = bundle. resourcePath, let resourceBundle = Bundle ( path: resource + " /ImagePicker.bundle " ) {
20+ if let resource = bundle? . resourcePath, let resourceBundle = Bundle ( path: resource + " /ImagePicker.bundle " ) {
1221 bundle = resourceBundle
1322 }
1423
You can’t perform that action at this time.
0 commit comments