Skip to content

Commit

Permalink
Fix bug in instructions, decouple word guess row from clue length
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey Liu committed Mar 10, 2022
1 parent b03bd94 commit a2bd937
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions WordleWithFriends/How To Play/GameInstructionsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class GameInstructionsViewController: UIViewController {
let row = WordGuessRowView()
var guess = WordGuess(guess: "GEOFF")
guess.mark(2, as: .correct)
row.configure(with: guess)
row.configureExample(with: guess)

return row
}()
Expand All @@ -74,7 +74,7 @@ final class GameInstructionsViewController: UIViewController {
let row = WordGuessRowView()
var guess = WordGuess(guess: "APPLE")
guess.mark(3, as: .misplaced)
row.configure(with: guess)
row.configureExample(with: guess)

return row
}()
Expand All @@ -92,7 +92,7 @@ final class GameInstructionsViewController: UIViewController {
let row = WordGuessRowView()
var guess = WordGuess(guess: "PARKS")
guess.mark(0, as: .incorrect)
row.configure(with: guess)
row.configureExample(with: guess)

return row
}()
Expand Down Expand Up @@ -151,3 +151,13 @@ final class GameInstructionsViewController: UIViewController {
dismiss(animated: true)
}
}

private extension WordGuessRowView {
func configureExample(with wordGuess: WordGuess) {
removeAllArrangedSubviews()
wordGuess.forEach { letterGuess in
let tile = LetterTileView(letterGuess: letterGuess)
addArrangedSubview(tile)
}
}
}

0 comments on commit a2bd937

Please sign in to comment.