Answers for "get value of swift dictionary"

3

swift retrieve value from dictionary

var companies = ["AAPL" : "Apple Inc", "GOOG" : "Google Inc", "AMZN" : "Amazon.com, Inc", "FB" : "Facebook Inc"]

for (key, value) in companies {
    print("\(key) -> \(value)")
}

//Or if you only want the values:

for value in Array(companies.values) {
    print("\(value)")
}
// One value with direct access on the dictionary:

print(companies["AAPL"])
Posted by: Guest on March-05-2020

Code answers related to "get value of swift dictionary"

Code answers related to "Swift"

Browse Popular Code Answers by Language