Skip to content

How do I prevent my view controller from loading twice when I use the didDragCard function?  #68

Open
@tracknemo

Description

@tracknemo

New Issue Checklist

Question

Hi, I am overriding the didDragCard method and I essentially want a custom view controller I created to display upon dragging the card to the left. The issue arises after swiping the card, where the view controller is being pushed twice rather than only once. Here is my code:
`func didDragCard(card: CardCell, index: Int, swipeDirection: SwipeDirection) {

    let info = myArr[index]
    switch swipeDirection{
    case SwipeDirection.Left:
        let myVC = AccountOverviewVC(songType: info.songInfo, userId: info.uid)
        self.navigationController?.pushViewController(myVC, animated: false)
    default:
        print("do nothing because be we didn't drag left")
    }
}`

As mentioned, the function works although the view controller is pushed onto my view twice. I noticed that when I lightly drag the card (barely even dragging it) the expected behavior occurs (the view is only pushed once). But if I do a long drag in the left direction, the view is pushed multiple times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions