Possible Duplicate:
Difference between @interface definition in .h and .m file
What is the @interface declaration in .m files used for in iOS 5 projects?
I’ve seen code like this:
// In Header.h
@interface Header{}
@end
// In Header.m
@interface Header()
@end
My questions are:
- What’s the difference in putting it in 2 files?
- Why put {} after class name in “.h” file and why “()” in “.m” file?
is a class extension
with modern compilers this is a great way, to decrale methods, ivars and properties only for private use in the class MyClass.
Class extensions have to be declared in the main implementation file (not in a category).
So you can hide implementation details from the header file, they are private.