I've been chasing some circular dependencies recently and I'm trying to figure out what the most up to date way of importing things is. Googling isn't much use since that turns up generations upon generations of iterations for this stuff without a clear answer.
What I have now in the MyViewController.h
file:
@class ForwardClass;
@protocol ForwardProtocol;
typedef NS_ENUM(NSUInteger, XYZCharacterType);
@interface MyViewController: UIViewController
@property (strong, nonatomic) ForwardClass *fw;
@property (nonatomic, strong) id<ForwardProtocol> fwProtocol;
@property XYZCharacterType charType;
@end
and in the MyViewController.m
file:
@import MBProgressHUD;
#import "SomeManager.h"
#import "SomeOtherViewController.h"
#import "Model.h"
#import "MyViewController.h"
#import "MyProject-Swift.h"
@implementation MyViewController
@end
So the .h
file does not import anything anymore and only forward declares the files that it needs to get a handle on.
Is this the most current way of doing things? Are there any limitations to this that I should be aware of?