This tool will work with any Xcode including Xcode 8: this is not a plugin for Alcatraz which is not fully available in Xcode 8.
$ git clone https://github.com/kudinovdenis/Xcode-headers-sorting.git
$ cd Xcode-headers-sorting
$ ./install.sh
- Select headers
- Right-click on the text in Xcode editor
- Choose "Sort Alphabetically"
Just ctrl+shift+S
Before Sorting:
// headers group 1
#import "A_header.h"
#import "C_header.h"
#import "B_header.h"
// headers group 2
#import "A2_header.h"
#import "C2_header.h"
#import "B2_header.h"
#import "A3_header.h"
#import "C3_header.h"
#import "B3_header.h"
ctrl+shift+S
// headers group 1
#import "A_header.h"
#import "B_header.h"
#import "C_header.h"
// headers group 2
#import "A2_header.h"
#import "B2_header.h"
#import "C2_header.h"
#import "A3_header.h"
#import "B3_header.h"
#import "C3_header.h"
Delimiter symbols to group headers (see Example):
- \n (new line)
- // (comments)
Shortcut is not active on the first file right after Xcode is launched.