Dictionaries in Swift

You may know that in Swift arrays to read out a value, you can call it’s index value similar to:

var someArray = ["Farhan", "Syed", "March", "19", "1996"]


Instead of remembering the index value that is assigned to each value we can re-write this with a dictionary.

By dictionaries, instead of arbitrary numbers you have read and write values using a key you identify.

Let’s build a simple organized dictionary:

var someDictionary = [


You can read into a dictionary like so:


You can observe with dictionaries, you build it by writing it’s key, then a colon, then it’s value.

You can read any value from the dictionary you build by knowing the key.

Last Update: October 10, 2018  

October 10, 2018   557   Nandini Ramachandran    Swift Significance    
Total 1 Votes:

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *