Answers for "iterate over a dictionary swift"

2

loop key value swift

func findDic(dict: [String: String]){
    for (key, value) in dict{
    print("(key) : (value)")
  }
}

findDic(dict: ["Animal":"Lion", "Bird":"Sparrow"])
//prints Animal : Lion 
         Bird : Sparrow
Posted by: Guest on August-05-2020
0

ios iterate through dictionary

NSDictionary *myDict = @{@"Key 1" : @"Value 1",
                         @"Key 2" : @"Value 2"}
NSEnumerator *enumerator = [myDict keyEnumerator];
id key = nil;
while((key = [enumerator nextObject]))
    NSLog(@"key=%@ value=%@", key, myDict[key]);
Posted by: Guest on February-17-2020

Code answers related to "iterate over a dictionary swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language