Get dictionary value for key

 Problem

I have a Dictionary and want to get a specific value, by key.



 Recipe


// Initialize the Dictionary
var dict = ["name": "John", "surname": "Doe"]

// Get element for key "name"

print(dict["name"])
				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground