-1

I'm working on a menu for an application where you can scroll through images that take up the entire screen. There is also an overlay button to access another swift file. However, this button appears, I don't have an error message but when I click on it, nothing happens.

initially, I wanted that when we click on the image, it would take us back to the other swifr file, but as that didn't work, I fell back on an overlay button but that again doesn't work. I repeat that my program is running correctly, I have no error messages but it is simply the navigationLink which is not activated. I am attaching my main code. Thanks again for any help you can give.

import SwiftUI
struct dico {
var images = ["Capture d’écran 2023-08-07 à 14.36.37","logo promo drive", "CNRDal logo", "minia ep1", "minia ep2"]
var name = ["Best ouf", "CNRDal", "Marche charismatique", "Halloween le remake en mieux", "Die PferdeKiller"]
var series = [true, false, false, false, false]
var mainImage = ["20230331_143548", "Capture d’écran 2023-08-06 à 23.25.44", "Design sans titre-2 2", "Capture d’écran 2023-08-07 à 14.36.37", "minia die pferdekiller entière"]
var video = [" ", "CNRD vidéo reconstitution", "test marche charismatique pour xcode", "ba halloween + logo", "allemand fini"]
var videoExtension = ["mov", "mov", "mov", "mov", "m4v"]
}
struct ContentView: View {
    var dico: dico
    var body: some View {
        SliderView()
    }
}
struct bouton: View {
    var index: Int
    var body: some View {
            VStack {
                NavigationLink {
                    ItemDetail(dico: dico(), item: index)
                } label: {
                    Text("regarder")
                }
                .buttonStyle(.borderedProminent)
                .padding(6)
                .foregroundColor(.black)
            } .background(Color.white)
        }
    }
struct SliderView: View{
    public let timer = Timer.publish(every: 3, on: .main, in: .common)
    @State private var selection = 0
    let image = ["Capture d’écran 2023-08-07 à 14.36.37","logo promo drive", "CNRDal logo", "minia ep1", "minia ep2"]
    var body: some View {
        VStack {
            TabView(selection: $selection){
                ForEach(0..<5){i in
                        Image("\(image[i])").resizable().ignoresSafeArea()
                        .overlay ((bouton(index: i)))
                }
                }.tabViewStyle(PageTabViewStyle())
                    .indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
                    .onReceive(timer, perform: {_ in
                        withAnimation {
                            selection = selection < 3 ? selection + 1 : 0
                        }
                    })
                
            }.ignoresSafeArea()
        }
    }
    
    struct ContentView_Previews: PreviewProvider {
        static var previews: some View {
            ContentView(dico: dico())
        }
    }
    
    

0 Answers0