我正在使用最新版本的 MessageKit 进行练习,并且在编译过程中出现“'SenderType' 无法构造,因为它没有可访问的初始化程序”的错误,
为什么会发生,请同时推荐解决方案
谢谢你
import Foundation
import UIKit
import MessageKit
struct Member {
let name: String
let color: UIColor
}
struct Message {
let member: Member
let text: String
let messageId: String
}
extension Message: MessageType {
**//ERROR IS SHOWN HERE**
var sender: SenderType {
return SenderType(id: member.name, displayName: member.name)
}
/* var sender: Sender {
return Sender(id: member.name, displayName: member.name)
}*/
var sentDate: Date {
return Date()
}
var kind: MessageKind {
return .text(text)
}
}