updating bundle manager

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-05-26 15:48:53 -05:00
parent c6002487db
commit 57135f8ac7

View File

@ -8,6 +8,8 @@
import Foundation import Foundation
import UIKit import UIKit
/// Bundle Manager keeps all bundles together for ease of use for searching within any of them for a specific asset
public class BundleManager { public class BundleManager {
public static var shared = BundleManager() public static var shared = BundleManager()
@ -28,6 +30,8 @@ public class BundleManager {
}) })
} }
/// With take a location and if found append to the local array for use later for asset searching.
/// - Parameter path: Location of the bundle
public static func register(_ path: String) { public static func register(_ path: String) {
if !shared.paths.contains(where: {$0 == path}) { if !shared.paths.contains(where: {$0 == path}) {
if let bundle = Bundle(path: path) { if let bundle = Bundle(path: path) {
@ -40,6 +44,9 @@ public class BundleManager {
extension BundleManager { extension BundleManager {
/// Searches through all registered bundles for an image
/// - Parameter name: Name of the image
/// - Returns: Will find an image or not.
public func image(for name: String) -> UIImage? { public func image(for name: String) -> UIImage? {
var foundImage: UIImage? var foundImage: UIImage?