I'm trying to add a button to the header of a SwiftUI list with :
@State private var isHovered = false@Query(sort: \SoundBoard.createdAt) var soundBoards: [SoundBoard]var body: some View { List{ Section() { ForEach(soundBoards) { board in Text(board.name) } } header: { HStack { Text("Mes soundboards") .font(.subheadline) .bold() Spacer() if isHovered { Button("Add", systemImage: "plus.circle", action: { isShowingItemSheet = true }) .labelStyle(.iconOnly) .tint(.accentColor) .buttonStyle(.plain) } } .onHover { hovering in isHovered = hovering } } }}
The problem, as you can see from the first attached gif, is that when the mouse hovers over the header the collapsing icon is shown, as is the add button (plus-circle). So far so good.However, when my mouse hovers over the collapsing chevron icon, the hover is no longer detected by the section header.
I'd just like to do what you see on the Apple Plan application (cd gif 2)
I'm a bit new to SwiftUI. Do you have any suggestions?
My app
Apple Plan App
Thank you in advance