gpt4 book ai didi

ios - 枚举错误 'member"不是 "Enum"的类型

转载 作者:行者123 更新时间:2023-11-28 08:31:49 26 4
gpt4 key购买 nike

我正在使用 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
}
}

最佳答案

这个框架我不是很熟悉,不过我觉得应该是这样的:

extension ViewController: KolodaViewDelegate {
func koloda(koloda: KolodaView, didSwipeCardAtIndex index: UInt, inDirection direction: SwipeResultDirection) {
if direction == .Right {
print("Apple")
} else if direction == .Left {
print("Cherry")
}
}
}

关于ios - 枚举错误 'member"不是 "Enum"的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38720854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com