# Programming in Swift: Functions & Types

Jan 4 2022 Swift 5.5, iOS 15, Xcode 13

## Part 3: Enumerations

### Episode complete

Play next episode

Next

Take your career further with a Kodeco Pro subscription. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

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.

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
``````