相关疑难解决方法(0)

在类型中找不到枚举案例开关

有人可以帮我这个.

我有以下内容 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)

enums ios reactive-cocoa swift swift2

9
推荐指数
1
解决办法
5730
查看次数

标签 统计

enums ×1

ios ×1

reactive-cocoa ×1

swift ×1

swift2 ×1