# Programming in Swift: Functions & Types

Jan 4 2022 Swift 5.5, iOS 15, Xcode 13

## Part 3: Enumerations

### Lesson Complete

Play Next Lesson
Next

Update Notes: This course was originally recorded in 2019. It has been reviewed and all content and materials updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

I’ve got a challenge to help you practice using enumerations! You’ll find everything you need on page 3 of the Playground for this part of the course, including some starter code! Pause the video, try the challenges on your own, and then come back to compare your work to mine.

``````enum Suit
``````
``````enum Suit: String {

}
``````
``````case heart
case club
case diamond
``````
``````  case heart = "suit.heart.fill"
case club = "suit.club.fill"
case diamond = "suit.diamond.fill"
``````
``````let heartIcon = Image(systemName: 😺Suit.heart.rawValue).resizable()
let clubIcon = Image(systemName: 😺Suit.club.rawValue).resizable()
let diamondIcon = Image(systemName: 😺Suit.diamond.rawValue).resizable()
``````
``````enum Coin
``````
``````enum Coin: Double {

}
``````
``````  case penny = 0.01
case nickel = 0.05
case dime = 0.10
case quarter = 0.25
``````
``````let coinPurse: [Coin]
``````
`````` = [.penny, .penny, .dime, .quarter, .quarter, .nickel, .penny, .quarter]
``````
``````let total = coinPurse.reduce(
``````
``````.reduce(0.0) {
``````
``````{ (result, coin) -> Double in
``````
``````result + coin.rawValue
``````