Software Dev

Introducing Swift Collections

Swift Collections is out with some new collection-oriented extensions on the Swift language as a companion to Swift Algorithms and Swift Numerics.

πŸ‘‰ Introducing Swift Collections | github

Swift Collections gives you hybrid collection types like Deque, which is an array with “efficient insertions and removals at both ends”, OrderedSet, which is a “powerful hybrid of an Array and a Set”, and OrderedDictionary (like the actual dictionary).

And of course, they’re efficient. Now go forth and collect in new ways!

Software Dev

The Singleton Pattern – When There Can Only Be One β˜οΈ

Like so many smart and courageous people, the Singleton design pattern is often misunderstood.

Whether it is attacked as an anti-pattern, maligned as untestable, or misused as a global convenience, singletons take a lot of πŸ’© for just being what they are: a way to enforce that there is only ever one of something. I think they should call this pattern “The One”.

A real life example of a singleton is The President of the United States. We only ever have one president at a time. That’s a key part of the concept. It’s not just a convenience.

In software terms, singletons make sense in many cases such as the one and only instance of the current app running on the current iPhone.

With all this in mind, this quick post provides some nice context about singletons (aka the President) versus just a shared instance (hey, let’s all share this one bike) in Swift.

πŸ‘‰ What’s the difference between a singleton and a shared instance in Swift?

Thanks to iOS Dev Weekly for calling out the ongoing confusion on this topic. πŸ™

Music · Songs

The Sad Moon Above (karaoke edition)

Here is a “karaoke” version of The Sad Moon Above (barking dog demo), with really basic instrumentation to sing to and potentially record a voice track remotely.

Anyone can sing to this version, and then I can go back and re-record a few differently-styled instrumentations. I’m thinking a “dreamy” version, a “noisy” version, a 50’s version, a Weezer version, and a Walkmen version.

Here’s my own take. I’m not a singer. πŸ€¦πŸ»β€β™‚οΈ

We shall see where this ends up…