Recently I joined a new project with a large existing code base, which often uses a template that I have never seen in practice or in any of the literature.
As an example:
ClassA.h
@interface ClassA : UIViewController
@end
ClassA.m
@interface ClassA ()
@property (nonatomic,weak) IBOutlet UILabel *labelOne;
@property (nonatomic,weak) IBOutlet UILabel *labelTwo;
@end
@implementation ClassA
@end
ClassAHelper.h
@interface ClassAHelper : NSObject
- (void)configureClassA:(ClassA *)classA;
@end
ClassAHelper.m
@interface ClassA ()
@property (nonatomic,weak) UILabel *labelTwo;
@end
@implementation ClassAHelper
- (void)configureClassA:(ClassA *)classA {
classA.labelTwo.text = @"wtf?";
}
@end
Thus, classes are declared without (or a very small) external interface, and access to these class properties is achieved by declaring these properties that the access class is interested in by the anonymous category inside the access class implementation file.
, Objective-C , , ivars . , .m #, .h. , , .m . . , , , , .
, : , ? , , , ( - , ", , ?" ).