6 Replies
      Latest reply on Apr 1, 2019 6:32 PM by PaulSolt
      skaak Level 1 Level 1 (0 points)

        Hi there,

         

        I just started working on XCode 8, as I suppose a lot of others have done too ... Problem is that it now auto-indent my Objective C class properties and methods. This is all fine and dandy, but I am used to the previous way of doing things, and a lot of example code out there also works that way. I find this new auto-indent a bit too eager and want to switch it off, while retaining the 'usual' indenting on curly braces as before. How do I do this?

         

        TIA

        MG

        • Re: Disable auto-indent of properties and methods
          skaak Level 1 Level 1 (0 points)

          Well ... maybe I just needed to reboot the newly installed Xcode.

           

          Yesterday it was extremely annoying due to the problem I encountered but today it simply went away.

           

          I had to rub my eyes and go back to some code I created yesterday to convince myself it was not just a dream. I have not updated Xcode or made any configuration changes, but, voila, today it is indenting correctly. I have a sample of code to prove it, which I've pasted in here, but the message got lost through the formatting this applies. So you just have to believe me ...

            • Re: Disable auto-indent of properties and methods
              KGBird Level 1 Level 1 (0 points)

              I ran into this same issue today.  Whenever I entered a new Objective-C property or a new method, Xcode would indent it.  This is new and different behavior from what I experienced over the past 8 years.  After I quit Xcode and restarted it, Xcode no longer indented new properties and methods that I entered.  This much just be a bug in Xcode.

            • Re: Disable auto-indent of properties and methods
              KMT Level 9 Level 9 (13,965 points)

              Did you go to Xcode/Prefs/Text Editing/Indentation and deselect/disable auto?

                • Re: Disable auto-indent of properties and methods
                  KGBird Level 1 Level 1 (0 points)

                  Nope.  I haven't made any changes to any of thoise settings at all.  I didn't even know those settings existed  All I can tell you is that an hour ago, if I put the cursor to the right of the semicolon that ended a property and pressed Return, the new line would be indented.  If I entered something like"- (void) foo {" Xcode would indent the method definition.  After quitting and reopening Xcode, that no longer happens.  My symptoms sound exactly like what skaak encountered.  I don't use Xcode much these days.  I just went into fix a bug.  I added a new property and a method and the automatic indenting was driving me crazy.  I kept having to do Cmd-[.  After restarting Xcode I no longer have to do that.  I did check those settings and they  are all checked but I never touched them.  I assume all checked is the default.  It's not clear where those settings are applied.  I do want auto indentation for if statements, for statements, etc.  It's just that for 8 years my properties and methods have been left aligned, not indented inside the @interface or @implementation sections but Xcode was all of sudden indenting them.