在swift 2.2中的工作:
var messages = [JSQMessage]()
//...
for i in 1...10 {
let sender = (i%2 == 0) ? "Server" : self.senderId
let messageContent = "Message nr. \(i)"
var message = JSQMessage(senderId: sender, displayName: sender, text: messageContent)
self.messages += [message] //Cannot convert value of type '[JSQMessage]' to expected argument type 'inout_'
}
swift 3中的给我错误。试图使用
self.messages += [&message] // Type of expression is ambiguous without more context
如何解决?
答案 0 :(得分:0)