Xcode source automatic formatting

后端 未结 19 673
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 16:10

As a C# developer, I have become highly dependent on the automatic formatting in Visual Studio 2008. Specifically, I will use the CTRL + K , D

19条回答
  •  生来不讨喜
    2020-11-29 16:36

    If your Xcode version 3.x , you should use "User Script" With Uncrustify , here this a Example:

    #!/bin/sh
    
    echo -n "%%%{PBXSelection}%%%"
    $YOURPATH_TO_UNCRUSTIFY/uncrustify -q -c $YOURPATH_TO_UNCRUSTIFY_CONFIG/CodeFormatConfig.cfg -l OC+
    echo -n "%%%{PBXSelection}%%%"
    

    add above to your Xcode "User Script".

    if Xcode version 4.x , I think you should read this blog : Code Formatting in Xcode 4,

    In this way , used the "Apple Services" , but it's not good enough , cause too slow experience, does anyone has the same thing ?

    why apple drop "user script" .... xD

提交回复
热议问题