How to make an iOS asset bundle?

I saw a custom asset bundle in an iOS project I evaluated, so at least I know it's possible.

My issue is that I'm using a CATiledLayer with about 22,000 tiles for a given image and it takes a very long time to compile (half an hour clean build, 5-10 minutes for regular build). So, I want to take all of the images and make a custom bundle to make it portable and hopefully not recompile into the app bundle each time.

How do I go about this? I checked the docs, but didn't see an explanation on how to actually create the bundle.


Answer is stupidly simple

Make a folder in finder, add files to it, rename it to bundlename.bundle

drag into Xcode - success!

to access, use the form of PathToMainBundle+"/bundlename.bundle"


How to create a bundle

  1. Create a folder in finder.
  2. Add files to the folder
  3. Rename the folder so that its extension is .bundle (e.g. "New folder" -> "BundleName.bundle")

PS: You can at any time right click the folder and hit "Show package content" in order to add, remove or modify any of the files.

How to add the bundle to Xcode

  1. Drag it into Xcode

How to use the bundle

NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"BundleName" ofType:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:bundlePath]; 
NSString *resource = [bundle pathForResource:@"fileName" ofType:@"fileType"];

(Replace BundleName, fileName and fileType with appropriate names)