When I hit re-indent in my XCode project all lines that begin with a. (eg ViewModifiers) on a new line after a single line with only a closing bracket are moved 1 tab too far to the right.
Ie what should indent to
Button(
// Button code
)
.accentColor(.black)
indents to
Button(
// Button code
)
.accentColor(.black)
This used to work the upper way until a few XCode-versions or so, and since then it has been the lower style.
Is there a setting or possible XCode-extension that can fix this type of alignment?
Actually for all time of SwiftUI usage never met such problem (while, yes, now I see it). I assume it is a question of code styling, cause I never used closing single
)` and moreover use it at all.
The reason of sugar
style of ending closures which mostly and widely used, like
Button("Button") {
// Action code
}
.accentColor(.black)
and with single }
there is no such problem with auto-indentation.
So my recommendation is just change coding style to standard and forget about it
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.