Dictionaries initialization in Swift
Forums:
//Empty dictionary
let d1 = [Int : String]()
let d2: [Int : String] = [:]
//init with some data
let d3: [Int : String] = [1 : "one", 2 : "two"]
let d4 = [1 : "one", 2 : "two"]
- Log in to post comments