Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

swift dictionary get key from valye

let dict: [Int: String] = [1: "one", 2: "two", 4: "four"]

if let key = dict.someKey(forValue: "two") { 
    print(key)
} // 2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #swift #dictionary #key #valye
ADD COMMENT
Topic
Name
2+1 =