Latest0.1.0
Homepagehttps://github.com/bilby91/ReactiveMantle
LicenseMIT
Platformsios 7.0, requires ARC
DependenciesReactiveCocoa, Mantle
Authors

CI Status
Version
License
Platform

Usage

ReactiveMantle transforms NSDictionary values from a RACSignal into Mantle objects, just that.

For example, if we use AFNetworking-RACExtensions for Networking, you code could look like this:

Mantle model:

#import <Mantle/Mantle.h>

@interface Product : MTLModel <MTLJSONSerializing>

@property (nonatomic, copy) NSNumber *id;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSNumber *price;

@end

@implementation Product

#pragma mark - MTLJSONSerializing

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
  return @{
           @"id" : @"id",
           @"name" : @"name",
           @"price" : @"price"
           };
}

@end

Then we can make a request and transform the signal value like this:

@interface APIClient : NSObject

@property (strong, nonatomic) AFHTTPSessionManager *manager;

- (RACSignal *)getProducts;

@end

@implementation APIClient

- (RACSignal *)getProducts {
  NSString *path = @"/products.json";

  return [[[[self.manager rac_GET:path parameters:nil]
  replayLazily]
  parseResponseForClass:[Product class]]
  transformError];
}

@end

Take a look at the documentation for more information. :)

Installation

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

pod "ReactiveMantle"

Author

Martin Fernandez, [email protected]

License

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

Latest podspec

{
    "name": "ReactiveMantle",
    "version": "0.1.0",
    "summary": "ReactiveMantle helps you out mapping mantle objects",
    "homepage": "https://github.com/bilby91/ReactiveMantle",
    "license": "MIT",
    "authors": {
        "Martin Fernandez": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bilby91/ReactiveMantle.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/bilby91",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "public_header_files": "Pod/Classes/**/*.h",
    "dependencies": {
        "ReactiveCocoa": [
            "~> 2.4"
        ],
        "Mantle": [
            "~> 1.5"
        ]
    }
}

Pin It on Pinterest

Share This