有人可以帮我这个.
我有以下内容 public enum
public enum OfferViewRow {
case Candidates
case Expiration
case Description
case Timing
case Money
case Payment
}
Run Code Online (Sandbox Code Playgroud)
以下mutableProperty:
private let rows = MutableProperty<[OfferViewRow]>([OfferViewRow]())
Run Code Online (Sandbox Code Playgroud)
在我的init文件中,我使用一些reactiveCocoa来设置我的MutableProperty:
rows <~ application.producer
.map { response in
if response?.application.status == .Applied {
return [.Candidates, .Description, .Timing, .Money, .Payment]
} else {
return [.Candidates, .Expiration, .Description, .Timing, .Money, .Payment]
}
}
Run Code Online (Sandbox Code Playgroud)
但现在问题是,当我试图在我的行中获取枚举的值时,它会抛出错误.请看下面的代码.
func cellViewModelForRowAtIndexPath(indexPath: NSIndexPath) -> ViewModel {
guard
let row = rows.value[indexPath.row],
let response = self.application.value
else {
fatalError("")
}
switch row …
Run Code Online (Sandbox Code Playgroud)