YY Model用法

2022-12-27  本文已影响0人  和女神经常玩

接口部分

@interface BaseModel : NSObject<YYModel>

//定义一些公共参数
@property (nonatomic, retain) NSString *code;
@property (nonatomic, retain) NSString *message;
@property (nonatomic, assign) BOOL success;

//定义一些公共方法
//深拷贝
-(id)copyModel;

@end

实现部分

@implementation BaseModel

-(id)copyModel
{
    NSDictionary *modelJson = [self yy_modelToJSONObject];
    BaseModel *model = [[self class] yy_modelWithJSON:modelJson];
    return model;
}

@end

上一篇 下一篇

猜你喜欢

热点阅读