I have a cocoapod library which contains assets in 2 formats:
my podsp
If you're using SwiftUI, using the Image.init(_ name: String, bundle: Bundle?) initializer won't work, you have to initialize it like this:
func getImage(named name: String) -> UIImage {
// Use a random singleton class in your project.
// Emphasis on class, structs won't work.
let bundle = Bundle(for: [random class].self)
if let image = UIImage(named: name, in: bundle, compatibleWith: nil) {
return image
}
return .init()
}
Image(uiImage: getImage(named: "image_name"))