Numero Uno Software Store

I have two instructions back to back:

  1. Now let’s add some cases with the following names and values:
    aceRepository : “Ace Repository”, dealForcer : “Deal Forcer”, kadencePlanner : “Kadence Planner”, mailCannon : “Mail Cannon”
  2. We’re going to want to iterate across this enumeration so let’s make it conform to the right protocol to enable this.

I don’t understand how I can both assign raw values to the enumeration AND make it CaseIterable, which in the lesson, specifically told us wasn’t allowed. If I choose one or the other, the program fails. Can anyone help me understand what I’m missing or not grasping? Thank you

1 Like

Since raw value type and CaseIterable come after a colon in the enum you can use commas to separate and get both.

For these two steps, you’ll want to do this:

enum ProductType: String, CaseIterable {
case aceRepository = “Ace Repository”
case dealForcer = “Dear Forcer”
case kadencePlanner = “Kadence Planner”
case mailCannon = “Mail Cannon”
}

1 Like