JoniVR / VerticalCardSwiper

A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How do I use a button on this card to launch a new ViewController>

Proudspark opened this issue · comments

New Issue Checklist

Question

A method I'm using on other ViewControllers no longer works when I attempt to use the method from the CardCell class:

@IBAction func Show_Me_Pressed(_ sender: Any) {
        let storyboard = UIStoryboard(name: "main", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "GameViewController") as UIViewController
        self.present(vc, animated: true, completion: nil)
}

returns error: Value of type 'CardCell' has no member 'present'

How can I open a ViewController over the Cards ViewController using a button on the ExampleCell.xib?

Thanks, any pointers greatly appreciated.

CardCell subclasses from UICollectionViewCell, so just like you would with a UICollectionViewCell. I would create either a delegate or closure for callback in this case (same way you would with UICollectionViewCell)