16

Xcode think that this:

NSArray *persons = @[
    @{
        @"name": @"Bob",
        @"pet": @"cat"
    },
    @{
        @"name": @"Alice",
        @"pet": @"dog"
    }
];

would be better indented like so:

NSArray *persons = @[
@{
@"name": @"Bob",
@"pet": @"cat"
},
@{
@"name": @"Alice",
@"pet": @"dog"
}
];

Can you teach Xcode about indenting Objective-C literals?

Is there another alternative?

Note: I already know I can "force" indent with cmdopt], however this will go away when copying/pasting and will not fix the problem.

Tyilo
  • 28,998
  • 40
  • 113
  • 198
  • All formatting goes away when copying/pasting unless you "paste with style", doesn't it? – user1118321 Sep 15 '12 at 01:02
  • 1
    @user1118321 Yes, except it's called `Paste and Preserve Formatting` and the keyboard shortcut is opt+shift+cmd+V – Tyilo Sep 15 '12 at 15:06

2 Answers2

5

Open a bug with http://bugreport.apple.com.

If you also submit it to OpenRadar, people outside Apple can read it. I can point you at this bug report about your specific issue: http://openradar.appspot.com/12394453

The more people who report this problem, the more priority Apple will give it.

Graham Perks
  • 23,007
  • 8
  • 61
  • 83
0

Xcode 5 auto-indents like this:

NSArray *persons = @[
                     @{
                         @"name": @"Bob",
                         @"pet": @"cat"
                         },
                     @{
                         @"name": @"Alice",
                         @"pet": @"dog"
                         }
                     ];
rickster
  • 124,678
  • 26
  • 272
  • 326