Haptic feedback on tabItem click

Hi,

I'm trying to add haptic feedback to a tabItem inside a tabView with this code (just a part of the ContentView file):

@State private var tabSelection = 1
    var body: some View {
            TabView(selection: $tabSelection) {
                view(request: URLRequest(url: URL(string: "https://gnets.myds.me/stundenplan/gymnasium.php")!)).previewLayout(.fixed(width: .infinity, height: .infinity))
                    .tabItem {
                        Image("1")
                        Text("Gymnasium")
                    }.onTapGesture {
                        self.tabSelection = 1
                    }
                view(request: URLRequest(url: URL(string: "https://gnets.myds.me/stundenplan/lyzeum.php")!)).previewLayout(.fixed(width: .infinity, height: .infinity))
                    .tabItem {
                        Image("2")
                        Text("Lyzeum")
                    }.onTapGesture {
                        self.tabSelection = 2
                    }
                view(request: URLRequest(url: URL(string: "https://gnets.myds.me/stundenplan/nou/")!)).previewLayout(.fixed(width: .infinity, height: .infinity))
                    .tabItem {
                        Image("3")
                        Text("Neuigkeiten")
                    }.onTapGesture {
                        self.tabSelection = 3
                    }
            }.onTapGesture {
                let impactLight = UIImpactFeedbackGenerator(style: .light)
                impactLight.impactOccurred()
            }
    }

After testing on a iPhone, the haptic feedback acts in on click of a tabItem, and also on click of the entire view (which is fine), but the view (tab) doesn't change. (I added the variable tabSelection to make the tabItem force change the view, but it still doesn't work.)

What I need is that on click of a tabItem, the view changes (as normal), but also gets a light haptic feedback.

Haptic feedback on tabItem click
 
 
Q