This is what you can do with Enums in Swift

Channel Avatar
This is what you can do with Enums in Swift
This is what you can do with Enums in Swift
Hello everyone, today we will talk about my favorite feature in Swift: Enums

Enums are art because they help you to represent a finite number of possibilities in our software problems. Swift makes use of enums in A LOT OF WAYS. Let’s begin and discover more about all its magic!

0:00 – Intro
0:27 – Blackjack Rules
0:54 – The problem that enums solve
2:01 – The basics
3:01 – Raw Values
4:30 – Enums support computer properties
5:09 – Avoid default in a Switch
6:09 – Blackjack Game
6:30 – CaseIterable
7:03 – Generate blackjack hands
7:23 – Associated Values
8:02 – Business logic for BlackJack
11:51 – Get associated values in a switch
12:31 – Protocols in Enums
13:16 – Recursive enums (Indirect)
15:00 – Getting a single case from an if
15:38 – BlackJack in SwiftUI
17:03 – Enum actions that represent UI events
18:58 – Do you want to learn more?


Source code shown in the video:

* Binary tree with enums:

Other videos in the channel:
* Why can’t you use Int indices in a String?:
* LazyVStack:
* GeometryReader and apple Watch animations:
* What’s new in SwiftUI 3.0:
* Swift Concurrency:

Don’t forget to subscribe to the channel, like it, and follow me on social media:


Finally, ask me for a video you would like to see next !

– Music by Wataboi from
– Video edited with LumaFusion

Take the opportunity to connect and share this video with your friends and family if you find it useful.

Keywords: swift and tips, swift && tips, swiftandtips, pitt500, Pitt, Pedro Rojas, Swift, ios, ios development, swiftlang, iosdev, Enum, associated value, raw value, rawValue, CaseIterable, Switch, case, case let, blackjack, SwiftUI, computer properties, CustomStringConvertible, indirect, recursive enums

Read Also

Leave a Reply

Your email address will not be published. Required fields are marked *