DEV Community

Nathan Mattes
Nathan Mattes

Posted on • Originally published at zeitschlag.net on

100 Days of SwiftUI — Day 2

The second day of a hundred took me like 20 minutes. Today's topics were more complex data types: arrays, dictionaries, tuples and enums and when to use each of them.

I learned, that you can provide a default-value when accessing a dictionary using subscript(_:default:). When there's no value assigned to the key, you get your default-value back. And although I don't use enums with associated values very often, it was nice to be reminded about them.

At UIKonf 2020, Conrad Stoll gave an interesting talk about state driven development using enums in Swift, so one day, these associated values might come in pretty handy. Here're some sketchnotes of the talk.

Top comments (0)