While I agree that indent guides would be a very good thing, it doesn't matter so much to me because I've just discovered the joys of refactoring SwiftUI code, resulting in easy to follow code such as
var body: some View {
GeometryReader { geometry in
VStack {
displayTopRowControls()
displayColumnHeaders()
displayPluginGrid()
}
}
}
func displayTopRowControls() -> some View {
return HStack {
displayPluginTypePicker()
displayUpdateButton()
displayFilter()
Spacer()
}
}
func displayPluginTypePicker()-> some View {
return Picker(" Options", selection: $selectedOption) {
Text("VST").tag("VST")
Text("VST3").tag("VST3")
Text("CLAP").tag("CLAP")
Text("DEMO").tag("DEMO")
}
.pickerStyle(MenuPickerStyle())
.frame(minWidth: 150, idealWidth: 150, maxWidth: 150, maxHeight: 23, alignment: .center)
.padding(.top, 6)
.padding(.bottom, 0)
}
The key to it was my discovery of the return HStack/VStack/Whatever construction!
I've been doing Swift for about 4 days now, and this has really been a eureka moment for me, because without it, as @djn125wer2 says, SwiftUI code gets very dirty very quickly, particularly if, like me you are coding for a Mac screen rather than the more manageable dimensions of an iPhone or iPad.