Skip to content

Latest commit

 

History

History

day-029

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Day 29: Project 5, Part Three

Follow along at https://www.hackingwithswift.com/100/29.

📒 Field Notes

This day covers the final part of Project 5: Word Scramble in Hacking with Swift.

I have a separate repository where I've been creating projects alongside the material in the book. And you can find Project 5 here. However, I also copied it over to this repo in Day 27 so I could extend from where I left off.

With that in mind, the main focus of this day was extending the finished app according to a set of challenges.

🥅 Challenges

Challenge 1

Disallow answers that are shorter than three letters or are just our start word. For the three-letter check, the easiest thing to do is put a check into isReal() that returns false if the word length is under three letters. For the second part, just compare the start word against their input word and return false if they are the same.

  • 🔗Commit (I actually decided to allowed two-letter words. I can't justify rejecting "Pi" 🙂).

Challenge 2

Refactor all the else statements we just added so that they call a new method called showErrorMessage(). This should accept an error message and a title, and do all the UIAlertController work from there.

Challenge 3

Add a left bar button item that calls startGame(), so users can restart with a new word whenever they want to.