Change xcode auto indent inside block

238 Views Asked by At

I have a (actually a few) quite long api call with a callback block like this:

[[APIsController sharedInstance] submitCaptchaRequestWithParams:param 
                                                completehandler:^(NSData *data, NSURLResponse *response, NSError *error) {

}];

How do I change the xcode's auto-indent so it'll make the content of the block 4 spaces from the original line, like this:

[[APIsController sharedInstance] submitCaptchaRequestWithParams:param 
                                                completehandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    if (!error) {
        // Continue
    }
}];

instead of this:

[[APIsController sharedInstance] submitCaptchaRequestWithParams:param
                                                    completehandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                        if (!error) {
                                                            // Continue

                                                        }
                                                    }];

The current auto indent make leave so many blank spaces within the editor. My current indent setting is:

indent setting

1

There are 1 best solutions below

0
On

Just move block opening bracket to the new line:

[[APIsController sharedInstance] submitCaptchaRequestWithParams:param
                                                completehandler:^(NSData *data, NSURLResponse *response, NSError *error)
 {
     if (!error) {
         // Continue
     }
 }];