GreatApe
(Gustaf Kugelberg)
#1
In all the slides, and I think even some live coding examples, we see indentation like
VStack {
...
}
.padding()
But for me this indents as
VStack {
...
}
.padding()
Is this a bug, a setting, or do they manually format it like that?
1 Like
Jon_Shier
(Jon Shier)
#2
It’s Xcode’s terrible indentation. They fixed it for the slides. You should file a bug about it.
7 Likes
GreatApe
(Gustaf Kugelberg)
#3
That's a shame, I was really hoping there was some secret setting for this! This seems like a bug, not a matter of style, or is there any logic to it?
ever
(Ever)
#4
Update from WWDC2020:
Looks like this was fixed per What's New in Swift in the WWDC video library!
Jon_Shier
(Jon Shier)
#5
It's far better, though still flawed in some ways, like periods moving the line to the left (FB7758734). Overall some great improvements to SourceKit.
GreatApe
(Gustaf Kugelberg)
#6
Haha I was just watching that session now...
It‘s neither a bug nor a setting.
VStack
.init {
...
}
.padding()
When you have a trailing closure and more modifiers, opt out and use init
explicitly. Problem solved, no more weird indentation.
GreatApe
(Gustaf Kugelberg)
#8
Seeing that they brought it up in the session as an issue and released a fix for it, I’d say it’s pretty much a bug.
Thanks for the workaround though!
The latter is still a wrong indentation as you are not writing code similar to the following. The closing curly brace is not correctly indented.
if condition {
...
} else {
...
}
Have you checked out the Xcode settings and there the indentation settings?