Recorded – watch the full episode on YouTube.
Do you recommend one particular tool you use most of the time in Instruments, or you just try them all out and see which one works best for you?
Carola Nitz: I mean honestly I really don't use it that often. It's really just when I have like a memory issue and I need to see what kind of method is allocating the most. WWDC videos have been the best for me so far – Instruments 101, and going back even to older videos to get an overview of what tools are out there.
poto manipulate objects on the fly. It helped me so much where you just cast an address and then set the background color, set a frame. You can do it on the fly while your program is running."
Paul Hudson: I think if I could recommend to folks if you could do one change to improve your debugging workflow I would say to use conditional breakpoints more – that's my personal favorite thing. Because you can add breakpoints throughout your network stack for example, throughout your buying stack, throughout your authentication stack, or whatever it is you’re working on. and then just disable them all with the condition “is network debugging true? Is authentication debugging true?” All as an enum elsewhere in your code and just leave them there forever. Leave the whole stack of breakpoints in there forever and ever and ever, all disabled, all doing nothing. Until you enable an enum then bang – now you're debugging networking, bang now you're debugging authentication. That's my personal number one fix for better debugging. If you want to recommend to somebody your number one best piece of advice to improve debugging, what would it be?
Carola Nitz: For me, it's really that I use
po to manipulate objects on the fly. It helped me so much where you just cast an address and then set the background color, set a frame. You can do it on the fly while your program is running.
Paul Hudson: Manuel Carrasco Molina adds, "Start using gauges and deep dive in Instruments. And that's actually quite important because gauges are really nice in Xcode and you can totally ignore them by accident. They tell you the CPU load, the RAM load, and more right there in this basic summary. And if you need to go into it further, then fine – use Instruments. But for so many things these days you haven't got to go into Instruments, you can just stick in Xcode and use Xcode’s tools, which is really, really nice I think.
Carola Nitz: It's also the first thing I notice when I have a loop. In memory if something gets allocated a heck of a lot because I have a layout loop or something, the gauges are going up. And that's the first time that I see, "Okay, there's something going wrong."
This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.
SPONSORED In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it straightforward and reliable so you can get back to building your app. Oh, and it's free if your app makes less than $10k/mo.
Link copied to your pasteboard.