.h文件
@interface person : NSObject
@property (nonatomic , strong) NSString *Name;
@property (nonatomic , strong) NSNumber *Age;
-(instancetype)initWithDict:(NSDictionary *)dict;
+(instancetype)personWithDict:(NSDictionary *)dict;
@end
.m文件
@implementation person
-(instancetype)initWithDict:(NSDictionary *)dict{
if (self = [super init]) {
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
+(instancetype)personWithDict:(NSDictionary *)dict{
return [[self alloc]initWithDict:dict];
}
@end