XCode formatting

Discussion in 'iOS Programming' started by erdinc27, Apr 18, 2019.

  1. erdinc27 macrumors regular

    Joined:
    Jul 20, 2011
    #1
    Hello guys. Is there anyone who knows a code formatting library for XCode? the Project I am working changed so many developers and there is no a good format for the files. Some codes look like this
    Code:
    if (condition1) {
    
    } else {
    
    }
    Some others look like this
    Code:
    if(condition)
    {
    
    }
    else
    {
    
    }
    
    Same for methods also. I want to make everything standard. So is there any library that can make it for me in XCode?
     
  2. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    If this is swift then 'swiftlint autocorrect' will format your code.
     
  3. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #4
    Second one listed in the linked article -

    SwiftFormat, SwiftLint and Prettier with Swift Plugin

    On the other hand if it's not then perhaps -

    Uncrustify <http://uncrustify.sourceforge.net>
     
  4. erdinc27 thread starter macrumors regular

    Joined:
    Jul 20, 2011
    #5
    Hi Guys. The project is created in Objective-C. Is there any script for Objective-C?
     
  5. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #6
  6. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #7
    There is also clang-format. It is unfortunately not bundled with Xcode’s Clang, but you can install it through Homebrew.
     
  7. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #8

Share This Page

7 April 18, 2019