无法在Swift Beta 6中使用SequenceType

时间:2014-08-20 05:50:34

标签: xcode swift xcode6-beta6

在测试版5中,这段代码完美无缺,但它不能在Beta 6中编译。任何想法为什么?

struct GenericGenerator<T>: GeneratorType {
    var items: [T]
    mutating func next() -> T? {
        return items.isEmpty ? .None : items.removeAtIndex(0)
    }
}

class ExerciseContainer : SequenceType {

    var exercises: [Exercise] = []

    func generate() -> GenericGenerator<Exercise> {
        return GenericGenerator(items: self.exercises)
    }
}

enter image description here

0 个答案:

没有答案