I am creating a private library that includes resources that are referenced by components in the library. The library is shared with apps using CocoaPods. In the .podspec for
In your pod file: images are in .xcassets so it can be easily organized with 1x, 2x, 3x
s.resources = 'PodName/Assets/**'
Usage: Swift
let bundle = Bundle(for: ClassThatWillUseTheImage.self)
let image = UIImage(named: "close", in: bundle, with: .none)
Usage: Objective-C
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
UIImage *image = [UIImage imageNamed:@"close" inBundle:bundle withConfiguration:nil];
Tested in Version 11.4 (11E146) iOS 13.0+
Using #imageLiteral(resourceName: "close") does not work however, it shows the image being read but will throw and error.