SwiftUI CodeHistory project errors

I’m stuck on this part of the CodeHistory project due to the following errors in the Game Model:

E1 & E2: Generic struct ‘Dictionary’ requires that ‘Question’ conform to ‘Hashable’
Type ‘Question’ does not conform to protocol ‘Hashable’

E3: Value of type ‘() → ()’ has no member ‘shuffled’

E4: Tuple pattern cannot match values of non-tuple type ‘_’

struct Game {

private(set) var currentQuestionIndex = 0

private(set) var guesses = [Question: Int]()  // E1 & E2 here

private(set) var isOver = false

private let questions = Question.allQuestions.shuffled()  // E3 here

var guessCount: (correct: Int, incorrect: Int) {

var count: (correct: Int, incorrect: Int) = (0,0)

for (question, guessedIndex) in guesses {   // E4 here

if question.correctAnswerIndex == guessedIndex {

count.correct += 1

} else {

count.incorrect += 1



return count


The Question Model:

struct Question: Hashable {

let questionText: String

let possibleAnswers: [String]

let correctAnswerIndex: Int

static var allQuestions = {

Question(questionText: "Who invented the World Wide Web?",

possibleAnswers: [

"Steve Jobs",

"Linus Torvalds",

"Bill Gates",

"Tim Berners-Lee"


correctAnswerIndex: 3);

Question(questionText: "What was the first object oriented programming language?",

possibleAnswers: [






correctAnswerIndex: 0)



I made certain there were no typos and that the code matched the lesson. But I could def have missed something. Lol!

I am using a MacBook M1 Pro with OS 12.3.1 and XCode 13.4.1. I was thinking the course is a version behind, maybe? And I’m not sure where to find the version changes, if that’s the case. Any ideas are gratefully welcome. :slightly_smiling_face: