Qualcuno può aiutarmi con questo.Interruttore del caso Enum non trovato nel tipo
Ho il seguente public enum
public enum OfferViewRow {
case Candidates
case Expiration
case Description
case Timing
case Money
case Payment
}
E la seguente mutableProperty:
private let rows = MutableProperty<[OfferViewRow]>([OfferViewRow]())
Nel mio file di inizializzazione Faccio uso di alcune reactiveCocoa per impostare il mio 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]
}
}
Ma ora il problema, quando cerco di ottenere il valore del mio enum dentro le mie file i t genera errori. Si prega di guardare il codice qui sotto.
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
}
}
Si genera un errore: Enum case 'some' not found in type 'OfferViewRow
sulla linea let row = rows.value[indexPath.row]
E su ogni interruttore dichiarazioni getta: Enum case 'Candidates' not found in type '<<Error type>>
qualcuno può aiutarmi con questo?
puoi provare 'public enum OfferViewRow: Int' come dichiarazione di enum –
Non aiutare, anche provato il! – Steaphann
Qual è il tipo di costante 'riga'? –