Chapter 5: Moving development code into Preview Content

There are some errors in the code of the part.

The code in the book:

...
Ecercise.exercises[0],
...

should be:

Ecercise.excercises[0].exerciseName

hi Kevin! what code are you looking at? this is copied from the book:

extension HistoryStore {
  mutating func createDevData() {
    // Development data
    exerciseDays = [
      ExerciseDay(
        date: Date().addingTimeInterval(-86400),
        exercises: [
          Exercise.exercises[0].exerciseName,
          Exercise.exercises[1].exerciseName,
          Exercise.exercises[2].exerciseName
        ]),
      ExerciseDay(
        date: Date().addingTimeInterval(-86400 * 2),
        exercises: [
          Exercise.exercises[1].exerciseName,
          Exercise.exercises[0].exerciseName
        ])
    ]
  }
}
1 Like

The code in the picture blew the sentence — "In the Preview Content group, create a new Swift file named HistoryStoreDevData.swift and move the HistoryStore extension into it: "

oh, thanks! we’ll make sure that screenshot is updated correctly.

I just checked: I took the right shot for the 2nd edition, which will be published soon.

3 Likes

:smile:
Thank for your work!

2 Likes