I'm using KolodaView
library: https://github.com/Yalantis/Koloda
In this library, there's a publicly defined function in its delegate
method:
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection) {}
The SwipeResultDirection
is a enum, which is defined in the library:
public enum SwipeResultDirection: String {
case Left
case Right
...
}
But when I access it in my ViewController
, it has the error of
'Right" is not a type of "SwipeResultDirection"
Here's my code:
class ViewController: UIViewController {
@IBOutlet weak var kolodaView: KolodaView!
}
extension ViewController: KolodaViewDelegate {
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection.Right) {
// Error here
return
}
}
I'm not familiar with this framework, but I think it should be some of this:
extension ViewController: KolodaViewDelegate {
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection) {
if direction == .Right {
print("Apple")
} else if direction == .Left {
print("Cherry")
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.