Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add type check when it is class foundation #849

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MapleYin
Copy link

如果一个类的定义为:

@interface MJPerson : NSObject
@property (copy, nonatomic) NSString *name;
@property (nonatomic) BOOL isVIP;
@property (strong, nonatomic) NSArray<MJPerson *> *friends;
@property (strong, nonatomic) NSArray<NSString *> *books;
@end

但是给的 json 数据形如:

{
    "name": "myName",
    "isVIP": false,
    "friends": [],
    "books": ["book1", "book2", null, false, 123]
}

此时获得的模型中,books 属性就不能保证是 NSString

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant