Day 65
Day 65 ๊ด๋ จ
Project 18, part two
When I first took up cycling there was a particular long, steep hill I used to practice on, and it was so hard for me โ I remember getting off half way up and walking the remainder! I asked one of the team at my local bike shop about it, and his response really stuck with me: โit doesnโt get much easier, but you do get faster.โ
Today is another challenge day, and hopefully these challenges are getting a little easier to follow over time. I say โeasier to followโ rather than just โeasierโ because itโs an important distinction โ I donโt expect youโll ever find these challenges easy but you will at least feel more able to tackle them. As the bike shop person said: it doesnโt get much easier, but you do get faster.
Today you should work through the wrap up chapter for project 18, complete its review, then work through all three of its challenges.
Wrap up
Wrap up
Debugging is a unique and essential skill thatโs similar but different to regular coding. As youโve just seen, there are lots of options to choose from, and you will โ I promise! โ use all of them at some point. Yes, even print()
.
There's more to learn about debugging, such as the Step Into and Step Out commands, but realistically you need to start with what you have before you venture any further. I would much rather you mastered three of the debugging tools available to you rather than having a weak grasp of all of them.
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.
Click here to review what you learned in project 18.
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 your new knowledge to make sure you fully understand whatโs going on:
- Temporarily try adding an exception breakpoint to project 1, then changing the call to
instantiateViewController()
so that it uses the storyboard identifier โBadโ โ this will fail, but your exception breakpoint should catch it. - In project 1, add a call to
assert()
in theviewDidLoad()
method ofDetailViewController.swift
, checking thatselectedImage
always has a value. - Go back to project 5, and try adding a conditional breakpoint to the start of the
submit()
method that pauses only if the user submits a word with six or more letters.
Wrap up - Additional
Extra credit: If you have the time and would like to take your debugging skills further, try watching my video How to Debug Like a Pro. It was delivered at Appdevcon in Amsterdam, in 2018, but the tips youโll find there will help take your debugging skills further.
Thatโs another project finished, and a useful one too โ make sure and tell others about your continued progress!