HSplitView

Meta question: Is there an active nexus where people are asking SwiftUI questions?

I'm trying to create a macos app and wanted to play with SwiftUI. My goal is a window with 4 lists arranged horizontally across the top, and the lower half as TextEditor. I put together the following code:

struct ContentView: View {
	@State private var fullText: String = "Bazinga"
	
 	var body: some View {
		VSplitView() {
			HSplitView() {
				List() {
					Text("Alpha")
					Text("Bravo")
					Text("Charlie")
				}
				List() {
					Text("Protons")
					Text("Electrons")
					Text("Neutrons")
				}
				List() {
					Text("Blueberries")
					Text("Strawberries")
					Text("Cherries")
				}
				List() {
					Text("Ford")
					Text("Chevy")
					Text("Dodge")
				}
			}
			TextEditor(text: $fullText)
						.lineSpacing(2)
		}
	}
}

What I see when I open the window initially though is:

What do I change to get the 4 lists to be evenly distributed across the top? It manages to show both the TextEditor and the upper half, but only one of the 4 lists.

Apple wants us to use the Developer Forums. Whether that's active enough for you, I don't know.

1 Like

Run the app; it works fine.

Terms of Service

Privacy Policy

Cookie Policy