按照官方文档中
创建 LCCKUser的时候
配置用户系统之前需要新建一个表示 User 的 Model 并遵循 LCCKUserDelegate 协议
+ (instancetype)userWithUserId:(NSString *)userId name:(NSString *)name avatarURL:(NSURL *)avatarURL clientId:(NSString *)clientId{
LCCKUser *user = [[LCCKUser alloc] initWithUserId:userId name:name avatarURL:avatarURL clientId:clientId];
return user;
}
转成Swift的时候
swift代码:
static func user(withUserId userId: String!, name: String!, avatarURL: URL!, clientId: String!) -> Self! {
let user = LCCKUser.init(userId: userId, name: name, avatarURL: avatarURL, clientId: clientId)
return user!
}
这样写一直报错,Cannot convert return expression of type 'LCCKUser' to return type 'Self?' Insert ' as! Self',按照提示加了 ' as! Self'无效,懵逼了,原谅我渣渣技术,有没有swift的demo啊,看OC太头疼