I am using XCode 4.
I have a very long .m file with a lot of function implementation.
I’d like to sort the functions alphabetically by their name or by its return type or the same order in its .h file.
The purpose of this is to better organize my .m file. I recently rearranged the functions in its corresponding .h file and it would be great if their is an automatic way of sorting the function implementation the same way its ordered in the .h
Here is an example of what I have now.
Currently have.
.h file
-(void) a;
-(void) b;
-(void) c;
.m file
-(void) c;
-(void) a;
-(void) b;
I’d like .m to sort the same way .h is sorted. I really hope this is possible without me copy pasting. The file is thousands of lines long.
Cannot find a sorting function anywhere. But actually I find it more useful to group methods by its kind and use the pragma mark. E.g. all the MKMapViewDelegate methods come after the following pragma comment
This allows you to find methods more easily when you use the drop down right above the editor.
Apart from this the only best way to easily do the cut&paste job is to fold all the methods using menu Editor -> Code Folding -> Fold Methods & Functions as already pointed out by idz.
Also I would consider re-factoring of your class. Can you create several classes? Maybe you have utility methods that you can move into a general purpose utility class?