In this series of articles, I am going to mention few shortcuts that I hope would help you become more efficient while working with Xcode.

The mentioned shortcuts are the default ones that are provided by the Xcode 7.3 (7D175).
You can always change the key mappings from Xcode -> Preferences -> Key Bindings option.

^  - Control Key
 - Command Key
⇧ - Shift Key
⌥ - Option/Alt key
⏎ - Enter key

Edit all in scope (^⌘E):

Imagine you get to maintain an iOS project which was previously maintained by a team of non-native English speaking developers. While maintaining, you find that the developers have used “TableView” as the variable name for the UITableView. Being a perfectionist, it bothers you that the variable name is “TableView” instead of your preferred name “tableView”. After thinking a bit, you feel that you can find & replace all the occurrences of “TableView” with “tableView”. Pretty easy, right? Below screencast shows how this would work.

Edit all in scope

Xcode find & replace command issue when replacing a variable name in file.

Did you spot the problem with this approach?

The “find & replace all” action also alters the “UITableViewDelegate” class name to “UItableViewDelegate” since it contains the keyword “TableView”. So it updated the “UITableViewDelegate” to “UItableViewDelegate” and Xcode is not able to resolve this protocol name. So, what we can do? Better keep the variable name as “TableView”? No. This is where the Edit all in scope command comes to rescue.

The way edit all in scope works is you select the word that you would like to replace and press ^⌘E. This will highlight all the occurrences of your selected word in the current file. Any changes you make to the word will automatically be reflected in all occurrences of that word. Below screencast shows how this would work if we wanted to replace our variable name from “TableView” to “tableView”.

tableView

 Changing variable name using Xcode edit all in scope command ^⌘E 

Hope this article would help you save some hassle while editing the variable names in Xcode.

Do you have any product idea or business need?

How TO MAKE YOUR APP WORK OFFLINE

HOW TO MAKE YOUR APP WORK OFFLINE

Offline mobile app development is critical for users to sync their data properly, when offline. Here, we help you learn the process from implementation to data synchroniz

Omnivore POS integration - Ensuring Agility To Your Restaurant Businesses

Omnivore POS integration - Ensuring Agility To Your Restaurant Businesses

Omnivore software offers a point-of-sales integration API making the restaurant system agile, more customer engaging and adaptive to fast changing business environments.

Unit Testing using Mockk.io

Unit Testing using mockK.io in Kotlin

Learn about unit testing using mockk.io in Kotlin.