Iterating Through a Dictionary in Swift

后端 未结 7 664
醉话见心
醉话见心 2020-11-27 12:12

I am a little confused on the answer that Xcode is giving me to this experiment in the Swift Programming Language Guide:

// Use a for-in to iterate through a         


        
相关标签:
7条回答
  • 2020-11-27 12:48
    let dict : [String : Any] = ["FirstName" : "Maninder" , "LastName" : "Singh" , "Address" : "Chandigarh"]
    dict.forEach { print($0) }
    

    Result would be

    ("FirstName", "Maninder") ("LastName", "Singh") ("Address", "Chandigarh")

    0 讨论(0)
提交回复
热议问题