Challenge

We'll tie together a variety of Swift language techniques, giving you additional practice to create structs, functions, data types, and optionals, and use flow control structures.

To solidify your understanding of basic struct and class usage by practicing the creation of each type of object.

  1. Launch Xcode, and create a new playground, then save it to your desktop with the name Activity 5 - Final Activity.playground.
  2. Add the following enum, which will be used to classify customers by gold, silver, and platinum levels. Note that this enum has a rawValue of type String, which we will use while printing customer information:
    enum CustomerType:String {
        case silver = "SILVER"
        case gold = "GOLD"
        case platinum = "PLATINUM"
    }
  3. Create a new Customer ...

Get Beginning Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.