在 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
怎么修?