I have an enum that is set up like this:
enum Calculators {
case RECTANGLE
case CIRCLE
case TRIANGLE
case TRAPEZOID
case CUBE
case CONE
case SPHERE
case CYLINDER
case ASPHALT
case TACK_SEAL_COAT
case ASPHALT_YIELD
case SIDEWALK
case CONCRETE_DECK_SEALER
case CHIP_SEAL
case AGGREGATE_STOCK_PILE
case BACKFILL
case SALT_STOCK_PILE
case SALT_SPREADER_CALIBRATION
case ROAD_SALT_APPLICATION
static let groups = [[RECTANGLE, CIRCLE, TRIANGLE, TRAPEZOID],
[CUBE, CONE, SPHERE, CYLINDER],
[ASPHALT, TACK_SEAL_COAT, ASPHALT_YIELD, SIDEWALK, CONCRETE_DECK_SEALER, CHIP_SEAL, AGGREGATE_STOCK_PILE, BACKFILL],
[SALT_STOCK_PILE, SALT_SPREADER_CALIBRATION, ROAD_SALT_APPLICATION]]
func getCalculator(category: Int, row: Int) -> Calculators {
if let calculator = Calculators.groups[category][row] {
return calculator
} else {
return Calculators.UNDEFINED
}
}
}
My idea is that I will pass in the category of calculator that I want, followed by the specific calculator and it will return the correct enum, all based on what row was selected in a TableView.
The problem is that I'm faced with a confusing error. This first error is on the if let calculator line. The error reads Enum case 'Some' not found in type 'Calculators'. I'm not sure why it's looking for this.
What does this error mean and how can I resove it?