DAY 37

PROJECT 8, PART TWO


How did you get on with yesterday’s user interface coding? After you completed the topics, there was one thing I asked you to keep in mind: whether you prefer making user interfaces in storyboards or programmatically, it’s important you know how to do both. Now that you’ve done both, how do you feel about it?

This isn’t just a theoretical question – if you’re anything like me, it’s a question you’ll get asked a lot, so it’s important to think carefully about your answer.

As for me, my answer is pretty simple: I do whatever makes sense in each individual scenario. Sometimes that means using code, sometimes it means using Interface Builder, and sometimes it means using both – and that’s OK. The main thing is that you remember the words of John Woods: “always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live.”

Whether that’s making your UI in storyboards or in code is academic, really – what matters is that it was the best choice you could make for that problem, given the constraints you were working in.

You’ll be glad to see yesterday’s hard work pay off today, because we’ll be completing our game in under an hour of work. We laid all the foundations yesterday, so today we’ll be looking at loading levels and responding to button taps – no more Auto Layout for the time being!

Today you have three topics to work through, and you’ll learn about adding targets to a button, separating and joining strings, hiding views, and more.

Need help? Tweet me @twostraws!

100 DAYS OF SWIFT


The 100 Days of Swift is a free collection of videos, tutorials, tests, and more to help you learn Swift faster. Click here to learn more, or watch the video below.

Back to 100 Days of Swift

Click here to visit the Hacking with Swift store >>