I am using a List inside my MacOS SwiftUI app. I am facing an issue when selecting my first item with the background color of the active cell.
At the beginning I have no selected item. When I press any item in my List, it gets highlighted with the correct user's highlight color. However, there after it is getting displayed in grey.
When I select my other cells thereafter it is working properly and everything stays in the highlighted color.
I created a gif to show the problem:
When I first click "David John", it is blue and then rapidly grey. I want it to stay in blue.
My main view holds the current state of the active person:
Main View:
@State var selectedPerson: Person?
var body: some View
{
NavigationView
{
PersonList(selectedPerson: $selectedPerson)
PersonList:
List(selection: $selectedPerson)
{
ForEach(personItems.filter {self.checkSearchString(person: $0)}, id: \.self) { person in
At beginning, selectedPerson is nil, as there is no selected person. This is intended.. I tried setting it to the first person in my array, but than the cell is in grey aswell.
