Skip to content

Commit cde55c2

Browse files
committed
Change Bundle
1 parent 84f2687 commit cde55c2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/AssetManager.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@ import Foundation
22
import UIKit
33
import 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+
514
open 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

0 commit comments

Comments
 (0)