Can someone please explain what the major differences there are between Tuples and Dictionaries are and when to use which in Swift?
Dictionary
is Collection Type
, Tuple
is Compound type
.Dictionary
is Key Value
type, Tuple
is Comma separated list of multiple types
Dictionary:
var dictionary = ["keyone": "value one", "keytwo": "Value Two"]
Tuple:
let someTuple: (Double, Double, String, (Int, Int)) = (3.14159, 2.71828, "Hello", (2, 3))