-2

I have noticed that when going through a lot of the framework public header files, there are things like : ex :

@class UIImage;

NS_CLASS_AVAILABLE_IOS(2_0) @interface UIColor : NSObject <NSSecureCoding, NSCopying> {
    @private
}

I understand the NS_CLASS_AVAILABLE_IOS(2_0) and the rest, but I don't understand the use of the @class keyword.

If someone could explain the use, and how it is used I would appreciate it very much!

user2277872
  • 2,963
  • 1
  • 21
  • 22
  • http://stackoverflow.com/questions/322597/class-vs-import – thatzprem Sep 22 '13 at 04:31
  • I'm not being rude, but what does my rep have to do with this question? It is becuase i have answered questions for many different things and people said they were right...i did search for it, and didn't see anything. Excuse me for making a mistake – user2277872 Sep 22 '13 at 20:04

1 Answers1

4

This is a forward declaration: it basically tells the compiler that the class UIImage exists, without specifying what exactly it looks like.

It is recommended to use forward declaration of classes instead of importing header in header files to avoid coupling of classes and improve compilation time.

tiguero
  • 11,477
  • 5
  • 43
  • 61