Skip to content

Latest commit

 

History

History

day-074

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Day 74: Milestone for Projects 19-21

Follow along at https://www.hackingwithswift.com/100/74.

📒 Field Notes

This day resolves around recapping the content covered while going through Projects 19-21 in Hacking with Swift, and then implementing a challenge project.

Regarding the recap, I won't try to rehash what I wrote up already — but a few extra things are worth noting.

for case let

Using for case let to iterate through an array is inescapably cool. A bit trippy at first — but grokable the more you being to associating "case let" with "pattern-match and bind":

for case let label as UILabel in view.subviews {
    print("Found a label with text \(label.text)")
}

Recoloring SpriteKit Nodes

Though it seems like minutiae, the colorBlendFactor of SKNodes is anything but. Setting it to 1 allows us to recolor SKSpriteNodes dynamically and performantly, which can be critical for certain scenarios.

firework.color = UIColor.cyan
firework.colorBlendFactor = 1

Naturally, since this is SpriteKit, we can even animate this kind of change:

let action = SKAction.colorize(with: UIColor.red, colorBlendFactor: 1, duration: 1)

Apple's docs have some solid leads with more information:

🥅 Challenge Project

Your challenge for this milestone is to use those API to imitate Apple as closely as you can: I’d like you to recreate the iOS Notes app.

So... Notes has grown up quite a bit since I'm thinking this challenge was conceived. Needless to say, it's a bit out of scope for how I'm trying to integrate 100 Days of Swift into my other projects 🙂.

In any case, I did tackle this challenge to some extent when I originally went through Hacking with Swift. You can check out that code here. Though coincidentally, reading it now brings this Tweet to mind 😛.