AliSoftware / Xcode-Utils

A set of useful templates, macros, etc. to use with the Apple Developer Tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 UIViewControllers that 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.strings of your app with the strings needed for the library: the library will have its own Localizable.strings and 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 NSBundle like pathForResource:ofType: and 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 (see the UIImage+Bundle.h category in the demo project).

ObjcSubscriptingSupport.h

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 objectAtIndex:n] / [array setObject:... atIndex:n]
  • dict[k] is the same as [dict objectForKey:k] / [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.

TODOMacros.h

A header defining a lot of useful macros like TODO(x), FIXME(x), 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.

Xcode3

Legacy templates and Text Macros (snippets) for Xcode3. Now obsolete.

About

A set of useful templates, macros, etc. to use with the Apple Developer Tools


Languages

Language:Objective-C 99.7%Language:C 0.3%