How To Make NSLocalizedString Fun To Use

To localize apps (which means: to make them work in other languages) you need to avoid using plain @”strings” and instead use the one of the tedious functions NSLocalizedString, NSLocalizedStringFromTable, or NSLocalizedStringFromTableInBundle, that take two to four arguments. Horror.

I mean, any sane programmer will get a headache from replacing a simple @"Great!" with this:

So I took a leaf from WordPress, and shortened the calls:

Now localization is easy and fun: I simply type __(@"Great!") and the localization code is taken care of by the C pre-processor. Mission accomplished.

Store UIImage in CoreData Without Writing Any Code

There is an easy but little known way to store many kinds of UIKit objects in CoreData without writing any code. It works for UIImage, UIColor, UIBezierPath, MKPlaceMark, NSDate, and any other class that conforms to the NSCoding protocol.

What you need to do is set the attribute type to Transformable.

That’s it!

Now can set UIImage objects directly into your NSManagedObject objects: