Avatar ·

How to make VStack take full screen width in SwiftUI

Hello, colleagues! I'm new to SwiftUI and have been struggling for days with what seems like a simple task. I need VStack to stretch across the full screen width, but by default it adjusts to the size of its content. Here's my code: ```swift struct ContentView: View { var body: some View { VStack { Text("Hello, world!") .font(.largeTitle) Text("This is text inside VStack") .font(.body) } .background(Color.blue) } } ``` I expected the blue background to fill the entire screen width, but instead the VStack only wraps around the text. I tried adding `.frame(maxWidth: .infinity)`, but it didn't work — the background remained narrow. I also tried wrapping the VStack in a ZStack or HStack, but