Reputation: 10065
I'm sorry, I don't find an already asked question for this problem...
in Xcode, what is the shortcut to edit multiples lines like the "CMD+click" of sublime text?
Upvotes: 79
Views: 27038
Reputation: 21137
It is possible with Xcode 10+, see the wwdc2018 presentation of the functionality.
Ways to create multiple cursors:
- ⇧ Shift + ⌃ Control + Left Mouse Click: Will create a new cursor on every click
- ⇧ Shift + ⌃ Control + ↑: Will create a new cursor above
- ⇧ Shift + ⌃ Control + ↓: Will create a new cursor bellow
- ⌥ Option + drag: Will create a new cursor on every line you drag
preview:
For more information, see this answer
Upvotes: 136
Reputation: 33
Select the line you want to edit, then press option + command for a moment
Upvotes: 3
Reputation: 1
I had this same question a few weeks ago, if you use the Option Key you can use column select and edit multiple lines like in your picture. Where the confusion comes in is it is used for multiple things. If you click the option key over a variable or text it shows a question mark and shows information about what you click on. However, if you hold the option key while before the line or not over text it shows up as a plus symbol and you can drag and select multiple lines and edit them at the same time.
Upvotes: 0
Reputation: 179
Multiline editing is supported in Xcode 10, Ctrl + Shift + click the lines you want to edit.
Upvotes: 10
Reputation: 363
I'm not sure how helpful this is to you, but if you want to change a variable name, you can click it, hover over it until the triangle dropdown button appears, click it and select Edit All in Scope.
This allows you to change all instances of that variable name.
Upvotes: 12