Hacker News new | ask | show | jobs
by yeureka 3879 days ago
I use both on a regular basis, VS for my job and XCode for hobby work.

I prefer VS because it performs better when editing and navigating the code base ( it is actually faster to run in it inside VirtualBox than XCode natively ).

Also VS has code navigation and editing features that XCode lacks. For instance if you want to do a find/replace in VS you can double click on a word do Ctrl+H and the word you selected populates the search box. You can then populate the replace box with what you have in the clipboard or just type in what you want. In XCode you need to copy the word to replace into the clipboard, do a Cmd+F, paste the word into the search box and then type in the replace box. This is much slower.

In VS you can setup bookmarks in your code with Ctrl+F2 and jump between bookmarks by pressing F2. This is great when you need to have present multiple parts of the code base to accomplish some task. I don't know how to do this in XCode.

In VS you have a stack of source code windows that you can easily move about via Ctrl+W+n where n is the stack depth. This is incredibly useful to navigate between multiple files. Again, I don't know how to this without using the mouse in XCode.

Then there are other issues with XCode mentioned by other comments like the incredibly confusing build settings and the instability of the IDE.

I often wonder if Apple actually uses it to develop their software.

6 comments

I haven't used VS in many years, but I like what you describe. I don't know if this will be helpful, but these are my alternatives in Xcode:

> For instance if you want to do a find/replace in VS you can double click on a word do Ctrl+H and the word you selected populates the search box.

Your workflow sounds nicer than Xcode's here. While I don't often use find+replace, I do use project level find constantly. My muscle memory shortcut for this is:

Cmd+C, Cmd+Shift+F, Cmd+V, Return

I'm pretty sure I use this hundreds of times a day. Especially when analysing unfamiliar code to trace its execution paths.

> Ctrl+F2 code bookmarks

These sound really cool. A bit like numbered unit groups in Starcraft.

The only similar mechanism in Xcode is quick open. Cmd+Shift+O then start fuzzy-typing the name of a file, method or declaration and hit return to jump to it in the editor (option+return for assistant editor). I have actually changed my quick open shortcut to Cmd+Shift+D because it's easier to trigger one-handed.

> In VS you have a stack of source code windows that you can easily move about via Ctrl+W+n

Unfortunately, while a stack of source locations is maintained in Xcode, you can't jump to a direct location within the stack.

What I do here is use Ctrl+Cmd+Left and Ctrl+Cmd+Right to navigate back and forward in the history stack for an editor window. So, for example, if you Cmd+Click a symbol to jump to its declaration, you can press Ctrl+Cmd+Left to go back.

The one thing I like about Xcode's version of this is that it keeps track of source locations rather than files or windows. So you actually navigate back/forward within the same file (if you were jumping around within the file) as well as between files.

You can use Cmd+E to directly insert the selected text into the search buffer, so for the Project-Wide search you wind up with the shorter sequence:

Cmd+E, Cmd+Shift+F, Return

This sequence seems to work in many other apps, I don't know if it's a system command or just a common convention.

Thanks! That's really useful to know.
To find a word, just highlight it, hit Command-E to select it into search, and then use a search command such as Command-Shift-F or Command-G.
In regards to the find and replace, you can actually rename a variable or function by placing your cursor in it and hitting Cmd+Ctrl+E (that may not be the right shortcut, but I know there is one). No danger of changing something you didn't want to change.

As far as the file stack goes, I'm not really sure what that does; but Xcode has other navigation options, like tabs, and files can be switched with the fuzzy finder.

You are absolutely right about the instability—that's the reason I switched away from Mac/iOS development. Too many weird bugs, in Xcode and in Swift. I haven't found it too slow on an SSD but when I used an HDD the speed was horrible.

> ( it is actually faster to run in it inside VirtualBox than XCode natively ).

Is there anything special you're doing with VBox? In a Windows VM, Eclipse is mostly usable, but disk accesses (or something) have incredible latency. It makes opening a new tab take a few seconds.

>In regards to the find and replace, you can actually rename a variable or function by placing your cursor in it and hitting Cmd+Ctrl+E (that may not be the right shortcut, but I know there is one).

This only performs a rename in the current file though, not across all files in the current project. (At least in Xcode 5, maybe this has been changed in more recent releases.)

Still it is really useful.

>For instance if you want to do a find/replace in VS you can double click on a word do Ctrl+H and the word you selected populates the search box

I'm fairly sure Xcode has a command "enter search/replace string" that puts the current selection into the search/replace box.

I would love to know how to do this.
Across all (Cocoa?) Mac apps, cmd-e should do it. It definitely works in Xcode.
Here's an overview of all Visual Studio shortcuts (there are tons):

http://visualstudioshortcuts.com/2015/

For the find/replace in VS, you don't need to first double click on a word. You just need to stand anywhere on it and press Ctrl+H