Answers for "swift check value exist in dictionary"

0

swift 5 check if dictionary contains key

if let key = self.dictionary["key"] {
	print(key) // returns value
}

// OR
extension Dictionary {
  func contains(key: Key) -> Bool {
    self.index(forKey: key) != nil
  }
}
Posted by: Guest on June-01-2021

Code answers related to "swift check value exist in dictionary"

Code answers related to "Swift"

Browse Popular Code Answers by Language