Mu-An Chiou

Hacking with Swift

Trying out 100 Days of SwiftUI. This would probably be my 5th attempt for learning iOS/macOS development. 🤞 Hopefully I keep this up.

Day 10


So, it’s been half a year. I am back. Remember how confused I was by everything on Day 9? I decided it’s time to get some help. I reached out to my friend @dlackty and got him to give me a 2 hour crash course for iOS development.

I feel a lot better now, even though I think I still can’t be productive yet. Let me just write down the things we covered in the 2 hours.

That’s about everything. But first, I will have to review the stuff from before (9 days lol) and re-learn the Swift syntax. BRB.

Day 9


I didn’t open my laptop at all for the weekend. ✌️ Hopefully I still remember how things work.

It did seem like I managed to build some UI, but I totally got turned around. The Picker example in the demo code doesn’t work, and turns out it was because SwiftUI expects the containing view to be inside a NavigationView. But why? and why didn’t Xcode tell me this? And why is this the case—

Closure containing control flow statement cannot be used with function builder ‘ViewBuilder’

Why can I only use the language’s forloop syntax in some cases and not all? why is ForEach different/significant? and why is PreviewProvider code a thing? I know what it’s for but it seems weird that it’s code that lives in your feature code solely meant for the IDE.

I don’t want to simply accept and memorize these. I want to understand them. :old_man_yells_at_cloud: I stopped at this point for the day.

On the plus side though, this time I was indeed less overwhelmed by Xcode.

Day 8


Nothing new. Gonna save day 16 for tomorrow since that’s when I’ll have to start to use Xcode.

Day 7


I went through the topics through tests, and noticed that I missed fallthrough completely the first time around, probably because there wasn’t a code example for it.. so here’s the official doc for fallthrough. I like this a lot more for the explicitness.

Day 6


🤔🤔 Unwrapping 🤔🤔
Why create another variable just to check if a variable held value?
Why is func foo (number: Number?) { guard let number = number else { ... } } OK? Is variable shadowing not a thing?

Seems like ! is never a good idea when the result is crashing. try? is cool though.

Without actually writing the code every day I don’t feel like I’m memorizing the syntax.

Day 5


🤔 I don’t think I’ve ever wanted something like final class.

protocols are like type definitions? except you can define protocol extensions which would actually give objects that conforms to those protocol methods and vars? and extensions defaults can be overriden without override––Turns out this was explained in the next part, POP (11/5).

extensions with mutatability wasn’t really explained but was tested. Specifically I thought Int being a class doesn’t need the mutating keyword when being extended in order to perform mutation, but it did?!

I haven’t watched any of the videos since they take much longer than reading.

Day 4


Tests for property observers seem wrong. The valid code samples have closures that don’t return anything.

Now googling for Swift REPL so I can write some stuff to remember them better ➡ Introduction to the Swift REPL.

Turns out I missed a few chapters for Day 5, specifically everything after 7. variadic functions 🤦🏻‍♀️ because variadic parameters were in the access control tests. I went back to read them today as well.

Day 3


Trailing closure syntax isn’t confusing at all! Shorthand closure syntax isn’t confusing at all!!

Day 2


repeat { ... } while ... is new to me.

Day 1


Sure tuple can exist.