Skip to main content

Day 65

About 2 minSwiftcrashcoursepaul-hudsonswifthacking-with-swiftxcodeappstore

Day 65 ๊ด€๋ จ


100 Days of Swift - Day 65

Project 18, part two

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
100 Days of Swift - Day 65 - 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.open in new window

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:

  1. 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.
  2. In project 1, add a call to assert() in the viewDidLoad() method of DetailViewController.swift, checking that selectedImage always has a value.
  3. 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.

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 Proopen in new window. 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!


์ด์ฐฌํฌ (MarkiiimarK)
Never Stop Learning.