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

kolodaNumberOfCards is not being called when push new view controller #461

Open
atalayasa opened this issue Nov 16, 2020 · 0 comments
Open

Comments

@atalayasa
Copy link

atalayasa commented Nov 16, 2020

Hello, thank you very much for that great library. In my view controller I have KolodaView and buttons for programmatically dragging cards. When user swipe right it needs to go to the new view controller. So, I implemented following methods for this feature.

    func koloda(_ koloda: KolodaView, draggedCardWithPercentage finishPercentage: CGFloat, in direction: SwipeResultDirection) {
        switch direction {
        case .right:
            if finishPercentage > 90 {
                userDidRightSwipe()
            }
        default:
            return
        }
    }

    @IBAction func nextBtnPressed() {
        userDidRightSwipe()
    }
    
    private func userDidRightSwipe() {
        kolodaView.swipe(.right)
        navigationController?.pushViewController(ChatVC(), animated: true)
    }

When I click next button kolodaNumberOfCards method is firing and cards are decreasing as it's supposed to be. However when I called same method in draggedCardWithPercentage kolodaNumberOfCards method is not being called and cards are never finishing. My question if I'd like to push a new view controller in which delegate method should I apply?

Edit 1: I think the problem is about pushing new view controller because when I swipe left kolodaNumberOfCards is being called but if I try to swipe right (which is pushing new vc) kolodaNumberOfCards is not being called.
Edit 2: I have also implemented didSwipeCardAt and push new view controller inside it but this time when I call navigationController?.pushViewController(ChatVC(), animated: true) inside it animation is not working.

@atalayasa atalayasa changed the title kolodaNumberOfCards is not being called when draggedCardWithPercentage kolodaNumberOfCards is not being called when push new view controller Nov 16, 2020
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

1 participant