Set the entire line of code to move up or down:
Find your own configuration file in Xcode:
/applications/xcode.app/contents/frameworks/idekit.framework/versions/a/
Resources/idetextkeybindingset.plist
Edit the Idetextkeybindingset.plist with text and add the following code:
1 <Dict>2 <Key>GDI Duplicate Current Line</Key>3 <string>SelectLine:, copy:, Movetoendofline:,insertnewline:, Paste:, Deletebackward:</string>4 <Key>GDI Delete Current Line</Key>5 <string>Movetoendofline:, Deletetobeginningofline:,deletebackward:,movedown:,movetoendofline:</string>6 <Key>GDI Move Current line up</Key>7 <string>SelectLine:, Cut:, MoveUp:, Movetobeginningofline:, Insertnewline:, Paste:, Movebackward:</string>8 <Key>GDI Move Current line down</Key>9 <string>SelectLine:, Cut:, MoveDown:, Movetobeginningofline:, Insertnewline:, Paste:, Movebackward:</string>Ten <Key>GDI Insert Line Above</Key> One <string>MoveUp:, Movetoendofline:, Insertnewline:</string> A <Key>GDI Insert Line Below</Key> - <string>Movetoendofline:, Insertnewline:</string> - </Dict>
This dict is a set of operations that can set shortcut keys, where the key is the name, and the corresponding string is the corresponding set of actions
GDI Duplicate Current line copy the row to the following line
GDI Delete Current Line delete when moving forward
GDI move current lines up to move a row upward
GDI move current lines down move row down
GDI Insert Line Above Adds a blank row above the current line
GDI Insert Line Below adds a blank row below the current line (regardless of whether the cursor is at the end of the row)
3. Restart Xcode, in the Xcode menu, open Preferences, select Key Binding, and search for GDI at the top right:
Xcode set shortcut keys to move up or down the entire line