← Back

Day 3 of 100 Days of SwiftUI

10 Jun, 2024

Day 3 was all about data collections using arrays, dictionaries, sets and enums. Sets aren’t stored in a particular order and cannot contain duplicates which make them handy for some scenarios requiring quick data retrieval. Enums are also new to me and useful for values like “north, south, east, west” or days of the week so we don’t have to iterate strings / avoid typos etc when calling up the info.

Declaring an empty set:

var mySet = Set<String>()

Declaring an enum of card suites

enum Suite {
   case hearts, diamonds, clubs, spades
}

let card1 = Suite.diamonds

#100DaysOfSwiftUI #Swift #swiftui