We all have to deal with web service integration in our application. So why we waste our time and make that task for every single project we have? Well, worry no more! We nailed all the aspects of integration with web services so you can make that task in few minutes.
Get the latest version from Github:
33
14
Keep up to date on new releases, additonal tools, and techniques by watching our page
Tweets with 'ROADFramework'
This framework aimed to be your best friend when you work with web service based back-end. It handles for you all aspects of web service integration. It features REST web service integration, but will help you with any web service that use JSON or XML for data transition and even more.
You can map your web service methods to Objective-C class methods. The result will be returned via blocks in main thread so you can update you views without any problems from there. Both request and response data can be easily mapped with Serialization component to your classes. We use attributes for all mapping so it will be that easy as marking your properties with appropriate attributes.
All this goodies can be easily installed via CocoaPods, so don't hesitate to try it out right now. We have good documentation and example project for quick start.
Web service component helps you to integrate remote web service. Most useful functionality is configurable via attributes, but if you're missing something just plug in your custom handler.
Serialization component handles all transformation between stream and your Objective-C classes. Define appropriate attributes for mapping and you good to go.
RF_ATTRIBUTE(RFWebService, serviceRoot = @"http://headers.jsontest.com/")
@interface JsonTestWebClient : RFWebServiceClient
RF_ATTRIBUTE(RFWebServiceCall, method = @"GET", prototypeClass = [MyWebServiceResponse class])
RF_ATTRIBUTE(RFWebServiceHeader, headerFields = @{@"Text" : @"A lot of text",
@"Number" : [@1434252.234 stringValue],
@"Date" : [[NSDate dateWithTimeIntervalSince1970:100000000] description]})
- (id<RFWebServiceCancellable>)echoWithSuccess:(void(^)(MyWebServiceResponse result))successBlock
failure:(void(^)(NSError *error))failureBlock;
@end
RF_ATTRIBUTE(RFSerializable)
@interface Person : NSObject
RF_ATTRIBUTE(RFSerializable, serializationKey = @"id")
@property (nonatomic, copy) NSString *personId;
RF_ATTRIBUTE(RFSerializable, serializationKey = @"first_name")
@property (nonatomic, copy) NSString *firstName;
RF_ATTRIBUTE(RFSerializable, serializationKey = @"last_name")
@property (nonatomic, copy) NSString *lastName;
RF_ATTRIBUTE(RFDerived)
@property (nonatomic, readonly) NSString *name;
RF_ATTRIBUTE(RFSerializable, serializationKey = @"birthday")
RF_ATTRIBUTE(RFSerializableDate, format = @"yyyy-MM-dd'T'HH:mm:ss'Z'")
@property (nonatomic, strong) NSDate *birthday;
RF_ATTRIBUTE(RFSerializable, serializationKey = @"spouse")
@property (nonatomic, strong) Person *spouse;
RF_ATTRIBUTE(RFSerializable, serializationKey = @"children")
RF_ATTRIBUTE(RFSerializableCollection, collectionClass = [Person class])
@property (nonatomic, strong) NSArray *children;
@end
This framework rely on libObjCAttr library that brings attribution support to Objective-C. You can check out its github page to see what other benefits you can get from it, suggest some great idea or report an issue.
You can easily set up ROAD Framework via CocoaPods and use it just after taking a peek at README page of repository, but for some complex scenarios don't forget to look at our documentation. As open source product it lives via your contribution, so at least live us bug reports or even better, try to resolve some ticket from issue tracker.