Closed VowerOrg closed 4 years ago
@VowerOrg did you find a solution to it?
+1
Are you sure you wrapped everything in a NavigationView
? This issue is unrelated to Pages, but a NavigationLink
only works inside of a NavigationView
. Update Pages and try this:
import SwiftUI
import Pages
struct SettingsView: View {
var body: some View {
Text("Settings")
}
}
struct Car {
var model: String
}
struct CarsView: View {
let cars = [Car(model: "Ford"), Car(model: "Ferrari")]
@State var index: Int = 0
var body: some View {
NavigationView {
ModelPages(cars, currentPage: $index) { pageIndex, car in
NavigationLink(destination: SettingsView(), label: {
Text("Go to my settings...")
})
}
}
}
}
struct HomeView_Previews: PreviewProvider {
static var previews: some View {
CarsView()
}
}
I'm closing this for now, reopen it if this doesn't work for you.
How do we integrate navigation link with pages? I have tried the code below. The view shows it was clicked (visually), however no desination is actually navigated to.