Skip to content

Softshag/FAAdapt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAAdapt

[![CI Status](http://img.shields.io/travis/Rasmus Kildevæld/FAAdapt.svg?style=flat)](https://travis-ci.org/Rasmus Kildevæld/FAAdapt) Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

FAAdapt is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "FAAdapt"

Example

A model:

@interface Blog : NSObject 

@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *body;
@property (nonatomic, strong) NSSet *comments;

@end

The object to map

NSDictionary *dict = @{
    @"t": @"A title",
    @"b": @"A body",
    @"c" : @[@"A comment", @"another comment"]
};
FAObjectDescription *desc = AdaptObject(Blog.class, @{
    @"t": @"title",
    @"b": @"body"
});

NSError *error;
Blog *blog = [desc mapValue:dict error:error];

if (!error) {
    NSLog(@"Title: %@, Body: %@",blog.title, blog.body);
}

Author

Rasmus Kildevæld, [email protected]

License

FAAdapt is available under the MIT license. See the LICENSE file for more info.

About

Object mapper for objective-c

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages