Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple items navigation #33

Open
artalejo opened this issue Apr 20, 2020 · 1 comment
Open

Multiple items navigation #33

artalejo opened this issue Apr 20, 2020 · 1 comment

Comments

@artalejo
Copy link

artalejo commented Apr 20, 2020

Hello,

I am wondering if is there any solution for navigating to different items inside the QGrid.
When clicking in an item it processes all the items click actions and navigates to all the links one after the other.

QGrid(self.dashboardViewModel.dashboardItems, columns: 2, isScrollable: false, showScrollIndicators: false) { dashboardItem in
    NavigationLink(destination: PlayerProfileView(playerLocalId: dashboardItem.actionId)) {
        DashboardItem(dashboardItemVE: dashboardItem)
    }.buttonStyle(PlainButtonStyle())
}
@zgluis
Copy link

zgluis commented Apr 29, 2020

I solved it navigating programmatically, check this: https://stackoverflow.com/questions/57315409

And I also used .onTapGesture to execute the navigation:

QGrid(Storage.people, columns: 3) { person in
        GridCell(person: person).onTapGesture {
           self.viewModel.personTapped(person)
    }
}

Here is a very useful post about navigation: https://medium.com/better-programming/swiftui-navigation-links-and-the-common-pitfalls-faced-505cbfd8029b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants