Remove top margin in SwiftUI app for Apple WatchOS

96 Views Asked by At

My WatchOS app show a top margin and I don't know why. I'm using a VStack inside the main view, and I expect the title should be aligned top. How can I remove the top space? The only think I found to remove the space is adding .ignoresSafeArea() to VStack, but I think this isn't a good solution.

My code:

struct ContentView: View {
    var body: some View {
        VStack {
            Text("Hello, world!")
            Image(systemName: "globe")
            Spacer()
        }
        .frame(height: .infinity, alignment: .top)
        //.ignoresSafeArea()
    }
}

Preview (with VStack highlighted):

enter image description here

0

There are 0 best solutions below