我正在使用KolodaView库:https://github.com/Yalantis/Koloda
在这个库中,它的delegate方法中有一个公开定义的函数:
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection) {}SwipeResultDirection是一个枚举,它在库中定义:
public enum SwipeResultDirection: String {
case Left
case Right
...
}但是当我在我的ViewController中访问它时,它的错误是
'Right" is not a type of "SwipeResultDirection"
这是我的密码:
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
}
}发布于 2016-08-02 13:24:15
我不太熟悉这个框架,但我认为其中的一些应该是:
extension ViewController: KolodaViewDelegate {
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection) {
if direction == .Right {
print("Apple")
} else if direction == .Left {
print("Cherry")
}
}
}https://stackoverflow.com/questions/38720854
复制相似问题