1
我正在尋找這個最佳的語法:斯威夫特詞典:加入鍵和值轉換爲字符串
let responseParameters = ["keyA" : "valueA", "keyB" : "valueB"]
var responseString = ""
for (key, value) in responseParameters {
responseString += "\(key):\(value)"
if Array(responseParameters.keys).last != key {
responseString += "+"
}
}
//responseString: keyA:valueA+keyB:valueB
喜歡的東西數組joinWithSeparator,使用flatMap或類似的東西。 (學習目的)