Categories
SwiftUI

SwiftUI Day 2 of 100 – Complex data types

I’m back for a second day. That’s something, right?

In my programming experience, I’ve never encountered the word tuple before. The concept is somewhat familiar, as it seems a bit like PHP’s key/value pairings within arrays – though I guess that’s more closely related to a dictionary in Swift. I’m not sure I can clearly articulate the difference yet between a tuple and a dictionary other than the syntax you use to create them.

Given that PHP and Javascript are the languages that I’ve used the most, I tend to compare things to them. One of the big differences right away with Swift (and many other languages too I suppose) is the strict typing. The flexibility that PHP and Javascript afford will probably cause me a few headaches with Swift until I retrain my brain.

Overall, I found the Day 2 material deceptively challenging – my tired brain was making lots of silly mistakes, like thinking that something like this was valid code:

let ratings = [1: "Bad", 2: "OK", 3: "Good"]
let rating = ratings["2"]

I know that it’s important to review/learn some of these fundamentals, but I have to admit that I’m getting anxious to start writing code and practically learning something more meaty than dictionaries, tuples and enum raw values.

References

Leave a Reply

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