I\'m trying to replicate a for in loop I did in Objective C but am getting an \"\'AnyObject\' does not have a member named \'GeneratorType\' error:
for (NSS
This isn't a loop through a dictionary. It's looping though an array stored in one of the dictionaries keys. This is what would want to do if for example you had an array of strings as one of your dictionary's keys.
if let arr = dict["Files"] as? [String] {
for file in arr {
}
}
If you do want to just loop through the dictionary though, this is possible in Swift, and can be done like this:
for (key, value) in dict {
println("key is - \(key) and value is - \(value)")
}
One Liner for loop
dict.forEach { print("key is - \($0) and value is - \($1)") }