Swift Slowly: Day 27 - Hacking Swift 11

I’m up past midnight and thought that programming is probably the best thing to do.

So tonight/today, I’m learning about Protocols and extensions.

When it came to extensions, I think I learned just as much about the once that I got wrong as the ones that I got correct.

Three wrong answers in a row

Swift Slowly: Day 27 - Hacking Swift 10

Score card for class. Today is really cool because not only am I celebrating the inauguration of Joe Biden, but I’m on day 10 of Hacking with Swift!

Pretty proud of myself for the most part because most of my errors where me not reading the question correctly.

Swift Slowly: Day 26 - Hacking Swift 9

We continue with structs today and I think I’m getting it for the most part. The issues that I run into are ones where I don’t pay attention to property names.

Wrong property name.

This session wasn’t as long as others, but I feel that I needed that after going through closures.

Swift Slowly: Day 25 - Hacking Swift 8

Today, is an exploration of structs. A lot of Swift seems to be built using structs. I wasn’t 100% awake when I was doing the computed properties section.

I tried mixing property observers and computed properties, and that does not seem to work.

You cannot compute and observe values at the same time

I understand it as the value cannot be both observed and computed at the same time.

I still enjoy the fact that the questions keep us on our toes. This means that basic things can still trip you up if you attempt to rush through them.

I do wish that I had 100 out of a 100, but I want to be honest with myself.

Update: I used the wrong screenshot and had to remove the second image.

Swift Slowly: Day 24- Hacking Swift 7

Closures part 2!

Paul Hudson says that this is where closures start to look a little bit like line noise and it can be hard to follow functions that use closures as parameters. Needless to say, I’m happy that I started this section early in the day.

Text that shows when you get an answer correct.

Swift Slowly: Day 23 - Hacking Swift 6

Closures!!!

It took me a while to understand1 but this run through has really cemented how I look at them and just working with them in different tutorials.

For example, I had no idea what the section on “Closures as parameters” actually was saying. Now I can read the code and understand it.

Getting all the answer correct

I’m really excited and proud of myself! I did get a little too excited when I start the trailing closure syntax, but I can see where I went wrong versus just scratching my head about it.


  1. I’m still working towards understanding. ↩︎

Swift Slowly: Day 22 - Hacking Swift 5

Today, I decided that I’d use CodeRunner to look at the examples found in the tutorials. It’s part of SetApp.

CodeRunner running a code.

It’s simple and I can just run the code that I want without the overhead. Plus it catches errors that are in code, which helps when I’m going through tests and logic.

Error within application

At this point, you can really, really tell that the lessons are building on top of each other and you can’t rush through them.

Getting a problem wrong

I don’t like making mistakes. When I do, it drives the lesson home and keeps me awake and cautious of what I’m doing.

Error message when you make a mistake

As an added bonus, I’m learning that mistakes shouldn’t effect my ego so much.

Also, I can definitely get along with someone who writes this kind of code.


enum PizzaErrors: Error {
	case hasPineapple
}

Swift Slowly: Day 21 - Hacking Swift 4

Today is all about loops.

I learned that you can’t loop over a tuple. I think this is because you can’t guarantee that every item will be the same thing.

I got to spend some time look up how to get a real going because it feels like forever to check my answers in a playground sometimes.

Swift Slowly: Day 20 - Hacking Swift 3

I want to point out that I really enjoy the brief discussions on why things are the way they are in Swift.

Why do things this way in Swift?

I got into a grove with the operator overloading and made the assumption that ** was an exponent operator.

I found myself talking through the training and that really helped me with understanding.

I think I’m in the same boat as Paul when it comes to the ternary operators.

I’m very much in the “avoid where possible” camp because even though this code is longer I do find it easier to follow:

I didn’t know that switch statements read the value they were reading once as compared to the if statement which would read it every time that it does a comparison.

Swift Slowly: Day 19 - Hacking Swift 2

The introduction of complex data types: Arrays, Sets, and Tuples. I normally get sets and tuples mixed up hopefully not after today. I spent some time going through my older run throughs of the material.

In a previous attempt to make it through the 100 days, I had created an Xcode playground with pages for the different days.

Hacking with Swift playground

I’ll brush this bad boy off and use it to take notes. One of the gripes that I have that waiting for results feels kind of nerve wracking as I’m looking at the little spinner in the corner of the status bar.

I liked using playgrounds sometimes to see if certain lines are valid.

Using raw values with associated types

Apparently, you can’t use raw values with associated types in enums.

This one took a while, but I think this time was just a little more fun to do.

Completed!