Adding a NavigationLink prevent the item from being dragged
jfredsilva opened this issue · 1 comments
jfredsilva commented
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 commented
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
}
}
}