Problem with adding Extension using SquenceType


#1

original code:
extension SequenceType where Generator.Element == ExerciseType {
func totalCaloriesBurned() -> Double {
var total: Double = 0
for exercise in self {
total += exercise.caloriesBurned
}
return total
}
}

error code instructed me to rename “SequenceType” to “Sequence”

extension Sequence where Generator.Element == ExerciseType {
func totalCaloriesBurned() -> Double {
var total: Double = 0
for exercise in self {
total += exercise.caloriesBurned
}
return total
}
}

now the error is “Generator” is undeclared

I’m making the assumption because it’s Swift 3…?

Thank you


#2

Yes I have got same error different part of the unit 23.

extension Sequence where Generator.Element == ExerciseType
{
func totalCaloriesBurned() -> Double
{
var total: Double = 0
for exercise in self
{
total += exercise.caloriesBurned
}
return total
}
}

Use of undeclared type ‘Generator’

Listing 23.7

Can someone help us