I'm using KolodaView library to create a Tinder-like swipe view: https://github.com/Yalantis/Koloda
I implemented delegate
method in my ViewController
like this:
class ViewController: UIViewController {
@IBOutlet weak var kolodaView: KolodaView!
override func viewDidLoad() {
super.viewDidLoad()
kolodaView.dataSource = self
kolodaView.delegate = self
}
extension ViewController: KolodaViewDelegate {
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection) {
if direction == .Right {
print("apple")
} else if direction == .Left {
print("cherry")
}
}
}
It's supposed to print apple
or cherry
when I swipe the card, but it does nothing when I ran it.
OMG you have no idea, this is the most classic/stupid bug I ever made!
Actually, the original code works, it just didn't print in Xcode, because ->
I ACCIDENTLY DEACITVATED THE CONSOLE!
After I tried all the methods offered by all the kind people, I finally realized my debug area looked empty like this:
Then I clicked View -> Debug Area -> Activate Console
Then I finally saw the print :D