동일한 이름을 가진 두 개의 클래스가 있습니다. 나는 그것 때문에 갈등을 겪고 있습니다. JSON Model이 해당 이름을 사용하고 있으며 100 개가 넘는 다른 클래스가 가져 오는 이유 때문에 이름을 바꿀 수 없습니다.Objective-C에서 두 개의 사용자 클래스를 결합 할 수 있습니까?
결합 할 수 있습니까? 또는 JSONModel 솔루션?
클래스 1
#import "User.h"
@implementation User
+(User*)createWithDictionary:(NSDictionary*)dictionary inContext:(NSManagedObjectContext*)context{
//Censored
}
+(User*)createWithDictionary:(NSDictionary*)dictionary{
//Censored
}
-(void)updateWithDictionary:(NSDictionary*)dictionary{
//Censored
}
-(NSString*)classOfProperty:(NSString*)propName{
//Censored
}
@end
클래스 우리는이 문제가 있었을 때
@implementation User
+(JSONKeyMapper*)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{@"id": @"identifier",
@"first": @"firstName",
@"last": @"lastName",
}];
물론 조합 할 수 있지만 조합해야하는지 여부 만 말할 수 있습니다. – Caleb
여기서 무엇을하려고하는지 명확하지 않습니다. 같은 이름의 두 클래스가있는 이유는 무엇입니까? 최근에 JSONModel을 프로젝트에 추가 했습니까? 기존 사용자 클래스를 JSONModel에서 만들 수있게 하시겠습니까? 아니면 JSON 입력 파일의 "user"를 다른 클래스에 매핑 하시겠습니까? –