Storing icons statically as strings in custom class
I do something similar, except rather than creating my own class, I create a UIImage class category.

File names are called UIImage+Icon.h and UIImage+Icon.m.

In the .h, we have this:

@import UIKit.UIImage;

@interface UIImage (Icon)

+ (UIImage*)someIcon;
+ (UIImage*)someOtherIcon;

@end


And then put your code in the .m as normal.

Be sure to note @import UIKit.UIImage; versus the #import.  You don't need to import the entire UIKit.  @import is new in Xcode 5 and vastly speeds up compile time as it only imports the required modules.

Anyway, the advantage to this versus what you're doing is that we call our methods as such:

[UIImage someIcon];


It's clear as day that we're definitely returning a UIImage object, because we're calling a UIImage class method.

EDIT: Having just noticed that your class also includes a method which returns NSString, I still recommend the class category.  In this case, the imageToNSString method would look like this:

- (NSString*)toEncodedString;


The method doesn't take an argument because it is an instance method.  Because this is a UIImage class category, you can refer to self, which gives you the UIImage instance on which this method was called.



I personally like the UIImage class category, but another option that is still potentially better than what you're doing would be to create C-style functions.

So you'll have a .h file that would include this function declaration:

UIImage * imageFromString(NSString *str);


As well as a list of NSString * const objects that you send as arguments.  Then your .m, you've just got the logic for returning an image from a string.



The main point here is that there are two options here that don't involve a class called Icon.  The problem is, if there's a class called Icon, I kind of expect to be working with Icon objects in some way.  And I might even try to instantiate an Icon object, which makes no sense...

Ultimately though, if you're NOT going to create a UIImage class category OR use C-style functions and still work with the Icon class, since you only have class methods and your class certainly shouldn't be instantiated, I highly recommend adding this to your .h file:

+ (id)alloc __attribute__((unavailable("Icon class can not be instantiated")));
- (id)init __attribute__((unavailable("Icon class can not be instantiated")));


This will throw red errors and prevent compilation if anyone tries to instantiate the Icon class.  This is the worst option of the three I purposed in this situation, but it can be acceptable in some cases perhaps.