Why is there padding in the Watch Simulator & on a device?

I have a NavigationSplitView in my Watch App for watchOS 10, but it seems to have padding on the items in the list.

A simplified version is:

struct ListView: View
{
	let allItems: [ItemDetail] = [testData0]
	@State var selectedItem: ItemDetail? = nil
	var body: some View {
		VStack(alignment: .center) {
			NavigationSplitView {
				List(allItems, selection: $selectedItem) { item in
					NavigationLink {
						ItemView(name: item.name)
					} label: {
						TableRowView()
					}
				}
			} detail: {
				if let selectedItem {
					ItemView(name: selectedItem.name)
				} else {
					ItemUnavailableView()
				}
			}
		}
	}
}

struct TableRowView: View
{
	var body: some View {
		ZStack {
			Rectangle().fill(.blue)
		}
	}
}

When I run this on a watchOS Simulator (any Series/size) the list has leading and trailing padding. On an Ultra 2 it's about 18 pixels each side. On a Series 8 it's about 15 pixels. Why is this here, and how do I get rid of It? I want the list to fill the width of the screen.

Look on this screenshot. The blue rectangle is in the horizontal centre of the row, and to the left and right is a grey area with curved corners, like the blue rectangle is on top of a wider grey rectangle with curved corners:

It's very difficult to see, so you may have to zoom in a bunch.

Anyway, how do I get rid of it? I can move my content by applying negative leading padding, like .padding(.leading, -18) but then it'll be different for each device, and I hate using magic numbers in my code.

Answered by BabyJ in 765894022

If you're asking about removing the grey areas, then you can adjust the padding of the list items' contents with the listRowInsets(_:) modifier, like so:

NavigationLink {
    ...
}
.listRowInsets(.init())
Accepted Answer

If you're asking about removing the grey areas, then you can adjust the padding of the list items' contents with the listRowInsets(_:) modifier, like so:

NavigationLink {
    ...
}
.listRowInsets(.init())

Thanks! That's got it. I really - really - didn't want to go down the route of adding varying amounts of negative padding!

Why is there padding in the Watch Simulator & on a device?
 
 
Q