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

OC属性在Swift中可选值兼容性问题。 #18

Open
Liaoworking opened this issue Jun 17, 2022 · 0 comments
Open

OC属性在Swift中可选值兼容性问题。 #18

Liaoworking opened this issue Jun 17, 2022 · 0 comments

Comments

@Liaoworking
Copy link

在Swift项目中如果使用OC的属性,
例如 V2TIMGroupMemberInfo 模型中的
@Property(nonatomic,strong,readonly) NSString* nickName;
在Swift中默认为必选,这时候nickName为空的时候就会出现崩溃问题。

建议在可能为空的OC属性中加入_Nullable关键字 在Swift中会自动识别为可选。
@Property(nonatomic,strong,readonly) NSString*_Nullable nickName;

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

No branches or pull requests

1 participant