xcsort is an Xcode extension that sorts lines of text.
0. Enable the extension in System Preferences - Extensions;
1. Open a source code file, a JSON data file, or a text file in Xcode;
2. Select several lines of text;
3. Choose "Editor" - "xcsort" - "Sort Lines" menu command to sort the selected lines.
Sorting lines of code is useful to keep #import lines organized and avoid conflicts. When 2 people change a code file they might want to add a new #import line at the same time (at the end of the #include statements block) and will get conflicting changes. If the #import lines are sorted the chance of such conflict is smaller.
When working with text data files sometimes you might want to sort lines of a list, properties of a dictionary, or named constants. The xcsort extension can sort selected text in a file alphabetically. It is especially useful with longer lists or long lines when sorting manually becomes tedious.
This extension requires Xcode 8 or newer to work. See additional instructions on the support webpage.