From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Enums with values

Enums with values

- [Instructor] Enumerations are an important way of converting data. You've probably used them as a more structured form of constant values like I have with the size or the temperature that I have up on the screen right now. But there are situations which you might want to store more than one value or change the value. Enum cases can have parameter like syntax for storing values. So let's see how that works. Now, I'm going to go down here. I'm going to use beverage as my example. And if you look at beverage, it's got a drink formatter underneath here that I can output a string that makes more sense for that drink. And there are certain drinks that have certain exceptions like cocoa, and we may want to put some extra stuff about water or what kind of juice we have. So let's try something. For example, let's say, I want to say what kind of fruit juice I have, and I use the case juice. And I can put on the end of this,…

Contents