r/iOSProgramming • • Nov 12 '24

Question How do I duplicate a line in Xcode?

There is this handy shortcut in VS Code that allows you duplicate the current line just below. It’s no where to found in Xcode. Google didn’t help.

0 Upvotes

11 comments sorted by

16

u/WerSunu Nov 12 '24

macOS Standard across all relevant apps! Cmd-D

3

u/nrith Nov 12 '24

I’ve literally used Macs since the early 1990s, and you’ve just taught me something! I use it for duplicating other things, like files in the Finder, but never thought to try it on text. Thanks!

2

u/gonnabuysomewindows Nov 12 '24

I always replace this one in my editors to delete a line instead. Find myself doing that way more often

4

u/WerSunu Nov 12 '24

You pay your money and you make your choice. Most MacOS users like the default way.

1

u/overPaidEngineer Beginner Nov 12 '24

Do you know if there is a shortcut to just copy the said line, without pasting it right away?

3

u/WerSunu Nov 12 '24

Cmd C

1

u/perfmode80 Nov 13 '24

Cmd-C copies the selected text, not the unselected line

1

u/DaKidRoundDaBlock Jul 27 '25

Yo how did I not know this

1

u/Tabonx Swift Nov 13 '24

I bought this Xcode extension a few years back solely for duplicating lines: Revisor.

-2

u/conro Nov 12 '24

Turn on vim mode and “Yank line, paste”- yyp or Yp