Wrap up
Wrap up 관련
Yes, it took quite a lot of user interface code to get this project going, but I hope it has shown you that you can make some great games using just the UIKit tools you already know. Building user interfaces programmatically is obviously much less visual than using storyboards, but the flip side is that everything is under your control – there are no connections happening behind the scenes.
Of course, at the same time as making another game, you've made several steps forward in your iOS development journey, this time learning about addTarget()
, enumerated()
, joined()
, replacingOccurrences()
, and more.
Review what you learned
Anyone can sit through a tutorial, but it takes actual work to remember what was taught. It’s my job to make sure you take as much from these tutorials as possible, so I’ve prepared a short review to help you check your learning.
Challenge
One of the best ways to learn is to write your own code as often as possible, so here are three ways you should try extending this app to make sure you fully understand what’s going on:
- Use the techniques you learned in project 2 to draw a thin gray line around the buttons view, to make it stand out from the rest of the UI.
- If the user enters an incorrect guess, show an alert telling them they are wrong. You’ll need to extend the
submitTapped()
method so that iffirstIndex(of:)
failed to find the guess you show the alert. - Try making the game also deduct points if the player makes an incorrect guess. Think about how you can move to the next level – we can’t use a simple division remainder on the player’s
score
any more, because they might have lost some points.