Today is Day 31 of the 100 Days of SwiftUI. Today is the completion of project 5, the development of the WordScramble app. It’s largely a review and challenge day today, and the three challenges were interesting and fun: disallowing 1 or 2 letter answers, add a restart game button to the toolbar, and add a scoring system.
After completing the challenges I decided to give myself more practice by adding a little feature of my own. It bothered me that keyboard focus disappeared once you submitted the answer in the TextField. So I added a @FocusState boolean and used a .focused modifier to re-enable focus on the TextField whenever a user submits an answer and it’s successful, or whenever the user gets an error from the app and has hit okay on the alert message.
I think little challenges like this are good for experience, memory and increasing my skills. And heck, I thought of it and couldn’t help myself but fix the problem, it just bugged me.