0

I was wondering weather there is some dictionary or other data types in Swift3.1 that I can use to create tables for lookups only.

For example: I want to check if I alredy received a specific String already in O(N).

Of course I could do something like:

let dict = ["hello":true, "world":"true"]

and then check if my dictionary contains the inputString:

dict[input] != nil ? print("got it already") : print("new String")

But I would like to get rid of the boolean value that I have to add.

Michael
  • 1,030
  • 14
  • 29

0 Answers0