Enum case switch not found in type

Can someone please help me with this.

I have the following public enum

  • Decrypt Media Files in chunks and play via AVPlayer
  • How to make Playground execution time is as fast as if we run in iOS application
  • Swfit 2 “Extra argument 'error' in call”
  • Error when setting up google analytics in swift 2 and xcode 7 beta 4
  • Swift 2.0 NSURLConnection sendSynchronousRequest
  • Swift: Using protocol extension results in “unrecognized selector sent to instance”
  • public enum OfferViewRow {
        case Candidates
        case Expiration
        case Description
        case Timing
        case Money
        case Payment
    
    }
    

    And the following mutableProperty:

    private let rows = MutableProperty<[OfferViewRow]>([OfferViewRow]())
    

    In my init file I use some reactiveCocoa to set my 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]
            }
    }
    

    But now the problem, when I try to get the value of my enum inside my rows it throws errors. Please look at the code below.

     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
            }
        }
    

    It throws an error: Enum case 'some' not found in type 'OfferViewRow on the line let row = rows.value[indexPath.row]

    And on every switch statements it throws: Enum case 'Candidates' not found in type '<<Error type>>

    Can someone help me with this?

    Solutions Collect From Internet About “Enum case switch not found in type”

    The guard statement wants an optional, as hinted by “Enum case ‘some'” in the error message.

    But rows.value[indexPath.row] is not Optional<OfferViewRow>, it is a raw OfferViewRow. So it won’t enter a guard statement.

    Move let row = rows.value[indexPath.row] one line up: Swift takes care of bounds checking, and will crash if indexPath.row is out of bounds.