使用未声明的类型';键类型';词典内扩展(Swift)

使用未声明的类型';键类型';词典内扩展(Swift),swift,xcode6,swift-extensions,Swift,Xcode6,Swift Extensions,随着beta 5的更改,我在下面的扩展中遇到了一个与KeyType和ValueType相关的错误 extension Dictionary { func filter(predicate: (key: KeyType, value: ValueType) -> Bool) -> Dictionary { var filteredDictionary = Dictionary() for (key, value) in self {

随着beta 5的更改,我在下面的扩展中遇到了一个与KeyType和ValueType相关的错误

extension Dictionary {

    func filter(predicate: (key: KeyType, value: ValueType) -> Bool) -> Dictionary {
        var filteredDictionary = Dictionary()

        for (key, value) in self {
            if predicate(key: key, value: value) {
                filteredDictionary.updateValue(value, forKey: key)
            }
        }

        return filteredDictionary
    }
}

我可能遗漏了一些东西,但我似乎在发行说明中找不到任何相关的更改,我知道这在beta 3中起到了作用。

字典声明已更改为仅对其关联类型使用
,而不是
键类型
值类型

// Swift beta 3:
struct Dictionary<KeyType : Hashable, ValueType> : Collection, DictionaryLiteralConvertible { ... }

// Swift beta 5:
struct Dictionary<Key : Hashable, Value> : CollectionType, DictionaryLiteralConvertible { ... }

是否有一个单独的资源来记录每个Xcode构建中的所有破坏性更改?谷歌搜索每一个错误都快把我逼疯了。每个测试版都有一个章节介绍了这些变化,但没有太多细节。似乎有一些博主开始关注beta版的变化——我敢肯定,Erica Sadun和Airspeed Velocity都有关于这些变化的帖子。
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
    }
}