Xcode 4 Sort Files By Name

XcodeXcode4

Xcode Problem Overview


In Xcode 3.x I could do Edit > Sort > By Name. I cannot find this functionality in the new version of Xcode. How do I accomplish this?

Xcode Solutions


Solution 1 - Xcode

This is a missing feature (a major one, IMO) from Xcode 4.

EDIT: As of 4.2 it's back in!!!

Solution 2 - Xcode

It IS there in Xcode 4.2 (not sure about earlier versions though.)

y

Solution 3 - Xcode

From my previous answer :

This was, sadly, left out of Xcode4 -- I loved that feature. You can fix it though. Here's how:

First, jump over to Apple's Bug Reporter and file a feature request. Seriously, go ahead. I'll wait until you are back.

Back? Great! We are one step closer to getting that feature. Nice job!

Now for the poor man's substitute until Apple fixes it: Re-organize your project so most of your files sit in sub-directories (real ones, not Xcode logical "group" folders). Typically I have my files arranged in Classes, Controllers, Resources, Images, Foundation, and Supporting files. This covers about 95% of all my files. Whenever you need to reorder the files in Xcode, simply remove a folder reference and add it back -- the files in that folder will once again be in alphabetical order.

Admittedly, not as nice as in Xcode3, but once you have your project folder structure organized, it just takes a moment to re-alphabetize things without too much effort.

Solution 4 - Xcode

It's a missing feature, if you want to sort permanently. However, there is a feature to view items sorted temporarily, namely in the jump bar:

> Tip: Hold down the Command key when selecting a level in the path menu to view its items alphabetically.

http://developer.apple.com/library/mac/#recipes/xcode_help-jump_bar/Recipe.html

Solution 5 - Xcode

  1. Quit your project
  2. Backup your project.pbxproj just in case
  3. find the "children" session of your most annoying directory
  4. sort it somehow (I used linux sort -k3)
  5. Open your project.

Worked for me :P

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionghemptonView Question on Stackoverflow
Solution 1 - XcodeMarkPowellView Answer on Stackoverflow
Solution 2 - XcodechakritView Answer on Stackoverflow
Solution 3 - XcodememmonsView Answer on Stackoverflow
Solution 4 - XcodeEddie G.View Answer on Stackoverflow
Solution 5 - XcodejdtogniView Answer on Stackoverflow