0

I'm relatively new to iOS development but have completed some online course. I have a design question.

QUESTION:

I have 5 different sets of data, 2 of the data sets have the same fixed properties, the other three data sets have fixed stored properties as well but are different from the others. I want a user to be able to rate each item in the data sets one to three.

I figured the ratings could be:

enum conditions {
    case 1
    case 2
    case 3 
}

I'm not sure if I want to use structs or enums to describe the rest of the data.

What would you recommend?

toddg
  • 2,863
  • 2
  • 18
  • 33
  • Enums would work but the cases can't be named as a single number. You can do something like `one`, `two`, and `three` or `bad`, `neutral`, `good` as the case names instead. – Paolo Jun 01 '17 at 13:39
  • Okay, thanks. How about the data sets as well, Ideally each set has 7 case members or stored properties ( depends on if I use an enum or struct) and I want to create a function that allows an app user to rate each item in the (enum or struct). The case members or stored properties will always be the same from each user. – Ty-wan Claxton Jun 01 '17 at 13:45
  • I would suggest you experiment with both, specially if you're new to Swift. Seeing what works and what doesn't is a great way to learn. – EmilioPelaez Jun 01 '17 at 14:40
  • A rating sounds like just a normal number to me (an `Int`). This would make `<` work out of the box for comparing (so, sort on rating is basically free). – Lou Franco Jun 01 '17 at 15:24

0 Answers0