Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

General Question, Building an iOS app using MVC

So I have a few questions in general about tying things together. Lets say I have an enum filled with conditions as shown below.

  enum Condition {

   case poor 
   case fair 
   case excellent
   case dan

  }

I also have a class with stored properties

 class Shoe {
   var color: Condition
   var laces: Condition

   init(color: Condition, laces: Condition) {
    self.color = color
     self.laces = laces
    }
 }

My goal is to have users decide the condition of the object/variable inside of the class. Ideally I would like to accomplish this using MVC, setting the conditions up as buttons via UI. I'm learning online So I have a few questions.

  1. For the enum, is their anyway to connect buttons created in UI to the view controller in a way that the buttons represent the enum cases.
  2. For the class, although I'm not sure If its the best idea, Im thinking of creating a method that takes a dictionary of type [Object/Variable: Condition] and returns an interpolated string. "(object) is in (condition) Condition"
  3. I am also thinking I should create a second helper method to save the information and a for in loop to loop through the variables in the class ( there will be more variables than below).
  4. The final question I have is if its possible to have an label represent the stored properties in a class and how I should approach the label switching on variables in the class?