//: Playground - noun: a place where people can play import Cocoa extension Array { func dictionary() -> [K: V] where Element == Dictionary.Element { var dictionary = [K: V]() for element in self { dictionary[element.key] = element.value } return dictionary } } var dictionary = ["x": 7, "y": 3, "n": 14, "z": 9] dictionary = dictionary.filter{ $0.value % 7 == 0 }.dictionary() dictionary