iOS Debugging Fundamentals

Apr 27 2021 · Swift 5, iOS 14, Xcode 12

Part 1: iOS Debugging Fundamentals

10. Challenge: Putting it all Together

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 09. SwiftUI View Debugging Next episode: 11. Conclusion

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Transcript: 10. Challenge: Putting it all Together

Welcome back. I have now gotten rid of all of the bugs in my house and learned a lot about debugging in the process. The Task List application, however, has one last bug that you’re going to help fix in this challenge.

You may remember from episode 2 that when the plus button is tapped, nothing happens, which means there is no way create a new task right now. That’s precisely what you’re going to fix!

If you get stuck, set check out ContentView.swift, and focus on the sheet modifier along with its isPresented binding. Pause the video and come back when you’ve found the problem.

How did it go? This one was certainly a tricky one. The sheet modifier presents the NewTaskView when its isPresented parameter is set to true. In your application, that’s controlled by the modalIsPresented property.

In line 37 you can see that this property defaults to false. Tapping the plus button should set it to true within the button’s action.

Ahh, but it’s just setting it to false, which will never trigger the sheet presentation.

With the help of breakpoints, the variables view, and the console, hopefully you were able to get to this point. If not, don’t worry. Debugging is hard and some bugs can be quite difficult and time-consuming to fix.

To fix this final bug, change line 51 to read as follows:

self.isModalPresented = true

Run your app, click the plus button, and add some details for your task.