Does anyone know why Xcode sometimes uses one syntax against another to close closures?
Example:
func someThingWithABlock(block:(() -> Void)) {
block()
}
This is my preferred syntax:
someThingWithABlock { () -> Void in
}
But sometimes Xcode suddenly gives me this:
someThingWithABlock({ () -> Void in
})
I noticed that Xcode always prefers the second syntax when nested:
someThingWithABlock { () -> Void in
someThingWithABlock({ () -> Void in
})
}
But only when investing in another closing circuit:
func foo() {
someThingWithABlock { () -> Void in
}
}
I know that they are both essentially the same. But it annoyed me for several days, and now I wanted to find out more and possibly fix it.
source
share