I have array type like this :
let types = ["Notification","Type1","Type2","Type3"..."TypeN"]
And i'm using this extension to grouprBy an array by type
extension SequenceType {
func groupBy<U : Hashable>(@noescape keyFunc: Generator.Element -> U) -> [U:[Generator.Element]] {
var dict: [U:[Generator.Element]] = [:]
for el in self {
let key = keyFunc(el)
if case nil = dict[key]?.append(el) { dict[key] = [el] }
}
return dict
}
}
The problem is i'm getting weird order, The notification type is not the first element in my dictionary. Is possible to keep the same order of my types array into the dictionary ?