I am working on an app that will connect to different data providers, as I started developing different classes to handle those providers I started seeing similarities between the functionality I needed. so I decided to create a base classs that inherits from NSObject
, and expose some properties and methods on that class that are definitely appearing in all clients.
This is the base class
@interface AhmBaseDataLoader : NSObject {
NSMutableArray *elementsArray;
}
- (void)loadElements:(NSString *)searchValue;
@property (nonatomic, strong) NSArray *Elements;
And I have about four classes inheriting this class, all of them have to
loadElements:(NSString *)searchValue {
//I dO some data work here using NSURL and basic classes
NSData* data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
}
Now so far I've been using basic NSURLSession
work in the sub classes to load the data. This has been working ok so far. This all happens on background threads. the loading http process can be sometimes long and I need to be able to cancel that process sometimes.
So My question is, with this kind of setup, is it beneficial to include afnetworking? I know its very popular and super fast, but I am confused If I did use it would I make my baseloader inherit from AFHTTPSessionManager
, or create one as a property? What would be recommended for my scenario?