My List looks like this:
List(viewModel.exerciseSelection, id: \.id) { exercise in
AddWorkoutDetailView(exerciseName: exercise.name, gifImage: exercise.gifUrl)
.listRowInsets(EdgeInsets())
.listRowBackground(Color.backgroundColor)
.swipeActions(allowsFullSwipe: false) {
Button(role: .destructive) {
} label: {
Label("Delete", systemImage: "trash.fill")
}
}
}
.listStyle(.plain)
.scrollContentBackground(.hidden)
.listRowBackground(Color.backgroundColor)
EDIT: My whole View is structured like this:
NavigationStack {
ZStack {
Color.backgroundColor
.ignoresSafeArea()
VStack {
// some other stuff
List {
// my list from above
}
}
}
}
The Problem is, that when my List
is empty, there will be a black background and not my custom background color, which is present when the List
is populated.