-2

I'm following this tutorial

The tutorial preview looks like this:

tutorial list

Whereas, my list looks like this:

my list

Why does my list have a grey border whilst the tutorial's list fills the screen? (I'm using Xcode 13.3)

Here's my code:

import SwiftUI

struct ContentView: View {
    var body: some View {
        List {
            Text("Hello!")
            Text("Hello, world!")
            Text("Hello, everyone!")
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
            .previewInterfaceOrientation(.portrait)
    }
}
user3574603
  • 3,364
  • 3
  • 24
  • 59

1 Answers1

1

The default list style of SwiftUI 3 is insetGrouped

To get the appearance of the first screenshot you have to add

List {
   ....
}
.listStyle(.plain)

The date in the screenshot of the tutorial (Feb 2021) indicates that it has been created in SwiftUI 2.

vadian
  • 274,689
  • 30
  • 353
  • 361