誰か助けてもらえますか?タイプに列挙型のスイッチが見つかりません
私はpublic enum
public enum OfferViewRow {
case Candidates
case Expiration
case Description
case Timing
case Money
case Payment
}
そして次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]
}
}
しかし、今:私は私のMutablePropertyを設定するには、いくつかのreactiveCocoaを使用して、私のinitファイルで
private let rows = MutableProperty<[OfferViewRow]>([OfferViewRow]())
を問題は、私は私の行の中で私の列挙型の値を取得しようとするときエラーをスローします。以下のコードを見てください。
func cellViewModelForRowAtIndexPath(indexPath: NSIndexPath) -> ViewModel {
guard
let row = rows.value[indexPath.row],
let response = self.application.value
else {
fatalError("")
}
switch row {
case .Candidates:
// Do something
case .Expiration:
// Do something
case .Description:
// Do something
case .Timing:
// Do something
case .Money:
// Do something
case .Payment:
// Do something
}
}
これは、エラーがスローされます:ライン上のEnum case 'some' not found in type 'OfferViewRow
let row = rows.value[indexPath.row]
そして、それはスローすべてのswitch文で:Enum case 'Candidates' not found in type '<<Error type>>
は、誰かがこれで私を助けることができますか?
あなたはenumの宣言として 'public enum OfferViewRow:Int'を試してみることができます –
また、試してみてください! – Steaphann
定数 'row'の型は何ですか? –