Reputation: 403
I am trying to figure out how to use a shortcut to duplicate a line of code in Xcode version 12.4 (Especially in the .swift files, the current duplicate "cmd + D" shortcut works only for UIBuilder).
I saw a lot of documentation on the internet but nothing referring to newest versions of Xcode. Has anybody tried to solve this problem?
Upvotes: 0
Views: 1999
Reputation: 610
Your question was specifically for Xcode 12.4, but in Xcode 14.3 (14E222b) a simple Cmd + D
works fine for duplicating lines.
Upvotes: 4
Reputation: 143
It works for me:
open IDETextKeyBindingSet.plist
in /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
Add new -> Dictionary -> Add new Item inside -> new Item set String selectLine:, copy:, moveToEndOfLine:, insertNewline:, paste:, deleteBackward:
Like this:
Then assign a key in Xcode -> Preferences -> Key Bindings
Upvotes: 5