Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

swift dictionary contains key

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

// OR
extension Dictionary {
  func contains(key: Key) -> Bool {
    self[key] != nil
  }
}
 
PREVIOUS NEXT
Tagged: #swift #dictionary #key
ADD COMMENT
Topic
Name
7+1 =