Member-only story
Dictionary in Swift
Where? How does the Swift compiler store values in a Dictionary?
6 min readApr 23, 2020
These are called HashMaps in Java, but whatever language you are coming from a dictionary is a data structure that maps keys to values.
Prerequisites:
- Be able to produce a “Hello, World!” iOS application (guide HERE)
- Knowledge of optionals (guide HERE)
- Be familiar with += to increment values (guide HERE)
- Knowing something about force unwrapping would be useful (guide HERE)
- Knowing about Mutability is important (guide HERE)
Terminology
Character: A written character, usually associated with a letter of the alphabet
Dictionary: The association between keys and values (where all the keys are of the same type, and all values are of the same type)
Increment: An operator (+=) that adds one to the operand
Integer: A number that has no fractional part, that is no digits after the decimal point
Key-value pairs: A set of two linked data items, a unique identifier (key) and an item of data (value)