Skip to content

Instantly share code, notes, and snippets.

@thiagoramos23
Created October 10, 2014 17:20
Show Gist options
  • Save thiagoramos23/c2d2bcd5f06a22ec29cc to your computer and use it in GitHub Desktop.
Save thiagoramos23/c2d2bcd5f06a22ec29cc to your computer and use it in GitHub Desktop.
Domain JsonModelExample
//
// JSPost.h
// JSONModelExample
//
// Created by Thiago Ramos on 10/9/14.
// Copyright (c) 2014 br.com.exemplo.jsonmodel. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JSONModel.h"
@protocol JSComment @end
@interface JSPost : JSONModel
@property(nonatomic, strong)NSNumber *id;
@property(nonatomic, strong)NSString *title;
@property(nonatomic, strong)NSString *content;
@property(nonatomic, strong)NSArray<JSComment, Optional> *comments;
@end
//
// JSComment.m
// JSONModelExample
//
// Created by Thiago Ramos on 10/9/14.
// Copyright (c) 2014 br.com.exemplo.jsonmodel. All rights reserved.
//
#import "JSComment.h"
@implementation JSComment
+ (JSONKeyMapper *)keyMapper
{
return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
}
@end
//
// JSPost.h
// JSONModelExample
//
// Created by Thiago Ramos on 10/9/14.
// Copyright (c) 2014 br.com.exemplo.jsonmodel. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JSONModel.h"
@protocol JSComment @end
@interface JSPost : JSONModel
@property(nonatomic, strong)NSNumber *id;
@property(nonatomic, strong)NSString *title;
@property(nonatomic, strong)NSString *content;
@property(nonatomic, strong)NSArray<JSComment, Optional> *comments;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment