PodAsset 1.3.0

PodAsset 1.3.0

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Nov 2020

Maintained by Hai Feng Kao.

PodAsset 1.3.0

  • By
  • Hai Feng Kao


CI Status Coverage Status Version License Platform


Why is it so painful to access the assets in CocoaPods? Pain No More!

Get the damn image:

// Swift
import PodAsset

let bundle = PodAsset.bundle(forPod: "SomePod")
let img = UIImage(named: "SomeDamnImage", in:bundle, compatibleWith:nil)
// Objective-C
@import PodAsset;

NSBundle* bundle = [PodAsset bundleForPod:@"SomePod"];
UIImage* img = [UIImage imageNamed:@"SomeDamnImage" inBundle:bundle compatibleWithTraitCollection:nil];

Get the damn data:

// Swift
let data = PodAsset.data(forFilename: "SomeData.dat", pod: "SomePod")
// Objective-C
NSData* data = [PodAsset dataForFilename:@"SomeData.dat" pod:@"SomePod"];

Get the damn json:

// Swift
let jsonString = PodAsset.string(forFilename: "SomeDamn.json", pod: "SomePod")
// Objective-C
NSString* jsonString = [PodAsset stringForFilename:@"SomeDamn.json" pod:@"SomePod"];

To run the example project, clone the repo, and run pod install from the Example directory first.


The resource bundle name, by default, is the pod name. If not, please check the third party pod's podspec and find out the resource bundle name:

  s.resource_bundles = {
    'PodAsset' => ['Pod/Assets/*.png']

In the above example, the bundle name is PodAsset.


PodAsset is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "PodAsset"

How It works

Pod Asset will search all bundles and find the correct one.

If you don't want to use PodAsset, you can still find the correct bundle by bundleForClass:.

If the pod is loaded as a dynamic framework, locate its bundle by:

[NSBundle bundleForClass:[some class which is defined in your pod]]

If the pod is loaded as a static bundle, locate its bundle by:

[NSBundle mainBundle] 


[NSBundle bundleForClass:[some class in your app]].


Hai Feng Kao, [email protected]


PodAsset is available under the MIT license. See the LICENSE file for more info.