This repository aims to share some useful resources for Xcode and other Developer Tools.
File Templates for Xcode
This folder contains some File Templates so you can have a nice and homogeneous organization of your code in all your files.
LibraryWithRsrc : Static Library with Resource Bundle
This is an example of how to create a Xcode projet that generate both a static library and a resource bundle.
The aim of this project is to show how you can have a library that provide both functional code but also resources like XIB files, PNG files, xcdatamodels, and even Localized strings, without the need for you to copy each and every single resource in your application project.
There are a lot of advantages in this practice:
- Your library can provide
UIViewControllersthat are based on XIB files if necessary, and the XIB files will be provided by the library and not need to be copied in the application for this to work
- If your XIB files (used and provided by the library and its resource bundle) use themselves some images in an
UIImageView, the image will be loaded from the same bundle than the XIB, namely the resource bundle provided by the library too, and not the application
- If your library needs to provide some localized strings, there is no need to merge your own
Localizable.stringsof your app with the strings needed for the library: the library will have its own
Localizable.stringsand will be able to pick localized strings from it instead of the one from the application itself.
Once you have implemented a simple method in your library main class that returns an
NSBundle object that will represent the
resource bundle generated by the library (see demo project), you can use all the standard methods of
localizedStringForKey:value:table: to retrieve those resources.
For images, the
+[UIImage imageNamed:inBundle:] method is unfortunately a private method, but the demo project provides a workaround
UIImage+Bundle.h category in the demo project).
This file allows support for Objective-C Subscripting for SDKs prior to iOS SDK 6 and OSX SDK 10.7:
array[n]is the same as
[array setObject:... atIndex:n]
dict[k]is the same as
[dict setObject:... forKey:k]
If you compile your code with those older SDKs and need subscripting support anyway, simply include this file to have the definitions.
A header defining a lot of useful macros like
NOTE(x) to generate nice warnings to let you know you will have
to do some more work in that part of your code.
This is much more efficient that simply using "TODO" comments for example, because it generate a warning that you can't forget about (whereas a simple "TODO" comment will be forgotten quite quickly in practice, we all know that…) and that directly locate the part of the code that need more work to be done later.
Legacy templates and Text Macros (snippets) for Xcode3. Now obsolete.