5 Best Xcode Tips & Tricks
Hello everyone! There are so many hidden features of Xcode that could make your code better, faster, and cleaner and save you so much time. Let’s dive into a few.
Clean code is good code.
I’m a huge fan of clean and readable code, and a part of that is keeping your code indented to avoid errors like this.
Xcode’s got an awesome shortcut for this kind of issue.
First select your text using command-a. Then use control-i to indent. This is what you get.
And just add a }. So much better.
#2: Multiple Cursors
The more, the merrier.
All of us have had that moment when you need to delete or edit multiple lines of code at the same time, and Find & Replace won’t work. I suffered through lots of those until I found out about this handy tool.
This is one of those cases where I wish I’d known about this tool. To get multiple cursors, use command-shift down arrow or command-shift up arrow.
You can also use command-shift, then click on the places you need more cursors.
We’ve all used the Library, right? The little window with a bunch of views and code snippets and other handy tools. It’s the most annoying thing when you try to copy and paste something, and then it disappears.
Well, turns out there’s a way to make it an actual window!
Instead of command-shift-l, use command-option-shift-l to get this!
#4: The Minimap
Sometimes, you have a lot of code. It would be really cool if you could get a simple summary of all of it. Well, you can!
Just go to the menu bar, select Editor, then tap Minimap, near the bottom!
#5: Customize Touch Bar
On a Mac with a Touch Bar, you can customize the buttons displayed on it in Xcode.
This is one of the simplest and coolest ones. Just go to View->Customize Touch Bar in the menu bar.