The Dictionary declaration has changed to use only Key and Value for its associated types instead of KeyType and ValueType :
// Swift beta 3: struct Dictionary<KeyType : Hashable, ValueType> : Collection, DictionaryLiteralConvertible { ... } // Swift beta 5: struct Dictionary<Key : Hashable, Value> : CollectionType, DictionaryLiteralConvertible { ... }
So your extension should be:
extension Dictionary { func filter(predicate: (key: Key, value: Value) -> Bool) -> Dictionary { var filteredDictionary = Dictionary() for (key, value) in self { if predicate(key: key, value: value) { filteredDictionary.updateValue(value, forKey: key) } } return filteredDictionary } }
source share