DEV Community

loading...

100 Days of SwiftUI — Day 2

Nathan Mattes
By day, I'm an iOS developer. By night, I'm a human being/programmer/blogger/podcaster. ¯\_(ツ)_/¯, (-‸ლ) (╯°□°)╯︵ ┻━┻
Originally published at zeitschlag.net on ・1 min read

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.

Discussion (0)