Avatar
SE-0171 ができるようになったらこんな感じかな? let strings = ["a:2", "b:3", "c:5"] let dictionary = strings.reduce(into: [:]) { (r: inout [String: Int], e) in e.components(separatedBy: ":") => { r[$0[0]] = Int($0[1])! } } // ["a": 2, "b": 3, "c": 5] (edited)
10:59 AM
=> は前話してた Kotlin の let 代わり。