swift 5 dictionary contains key code example Example: swift check dictionary has key let hasKey = myDictionary.keys.contains("myKey")