Giter Club home page Giter Club logo

Comments (4)

mac-gallagher avatar mac-gallagher commented on August 16, 2024

I haven't tried this myself yet, but you will need to manage the gesture recognizers yourself. See https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers

from shuffle.

mac-gallagher avatar mac-gallagher commented on August 16, 2024

Will leave this open in case anyone else has tried this and can offer some help

from shuffle.

BayramInanc avatar BayramInanc commented on August 16, 2024

any update?

from shuffle.

BayramInanc avatar BayramInanc commented on August 16, 2024

Hi,

I added scrollview inside swipe card. The code is like, I added only difference parts.

1-) *TinderCardContentView

private func initialize() {
let scrollViewPanGesture = UIPanGestureRecognizer()
scrollViewPanGesture.addTarget(self, action:#selector(self.handle(gesture:)))
scrollViewPanGesture.delegate = self
scrollView.addGestureRecognizer(scrollViewPanGesture)
.......
.......
....
}

extension TinderCardContentView : UIGestureRecognizerDelegate{
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
}

*TinderCardContentView

2-) *SwipeView

public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return false
}
*SwipeView

3-) *SwipeCardStack

open var shouldRecognizeVerticalDrag: Bool = false

override open func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard let topCard = topCard, topCard.panGestureRecognizer == gestureRecognizer else {
return super.gestureRecognizerShouldBegin(gestureRecognizer)
}

    let velocity = topCard.panGestureRecognizer.velocity(in: self)
    let translation = topCard.panGestureRecognizer.translation(in: topCard.superview)
    if abs(velocity.x) > 0 {
        if abs(translation.x) > 1{
            return shouldRecognizeHorizontalDrag
        }else{
            return shouldRecognizeVerticalDrag
        }
    }
    else{
        return false
    }
    
}

*SwipeCardStack

from shuffle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.