在Swift中,为什么不能转换为MutableCollectionType的字符串数组?

时间:2015-02-21 19:20:48

标签: arrays swift generics collections

我正在尝试模拟一个对象进行测试,并且我的重写返回值没有使用此错误进行编译“[String]无法转换为'C'”

这是mock的函数覆盖,你可以看到我想返回一个字符串数组:

override func list<C: MutableCollectionType where C.Index == Int>(var list: C) -> C {
    return ["the dog that worried", "the malt that lay in"]
}

我已经确认数组符合MutableCollectionType

struct Array<T> : MutableCollectionType, Sliceable, _DestructorSafeContainer {

为什么我收到此错误?

0 个答案:

没有答案