Is it possible to have both a NavigationView link coexist with a tap gesture (onLongPressGesture)!?
I can not make it work for the life of me...
ScrollView {
ForEach(self.itemStore.items) { p in
NavigationLink(destination: Details(p: p)) {
CardDetector(p: p, position: self.position)
}
}
}
struct CardDetector: View {
var p: ListData
@State var position: CardPosition
@Namespace var namespace
var body: some View {
Group {
switch position {
case .small:
smallcardView(p: p, namespace: namespace)
.padding()
.frame(maxWidth: .infinity)
.frame(height: 120)
.background(BlurView(style: .regular))
.cornerRadius(10)
.padding(.vertical,6)
.onLongPressGesture {
withAnimation {
position = .big
}
}
.padding(.horizontal)
This causes issues with scrolling... which they say the solution is to add a onTapGesture
(according to the answer: Longpress and list scrolling) but then the NavigationLink
wont work!?