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

Adding a NavigationLink prevent the item from being dragged #7

Open
jfredsilva opened this issue Mar 1, 2021 · 1 comment
Open

Comments

@jfredsilva
Copy link

I added a Navigation link on the item in order to push a new view but by adding the navigation link (or a button) the swiping don't work anymore.

Any solution to have the item swipe and the navigation link on the item?

@trouvainGregoire
Copy link

trouvainGregoire commented Jul 4, 2021

I had the same issue.

I made this to solve it :

@State var activeMagazineID: Int? = nil

NavigationView{
            ACarousel(digitalMagazines) {
                magazine in
                VStack{
                    URLImage(magazine.thumbnail){
                        image in image.resizable()
                            .aspectRatio(contentMode: .fit)
                    }.cornerRadius(10)
                    Text(magazine.title)
                        .foregroundColor(.secondary)
                        .font(.subheadline)
                }
                .background(NavigationLink(
                    destination: MagazineView(magazine: magazine), tag: magazine.id, selection: $activeMagazineID){
                    EmptyView()
                })
                .onTapGesture {
                    activeMagazineID = magazine.id
                }
            }
        }

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