Newsletter: February 2020
đ Hi everyone
The first month of this new decade turned out to be a quite busy month for me â with 2020 kicking off with the return of my Basics article series, new prototypes, and my YouTube debut. Iâm still hard at work on a few bigger projects that will launch later during the year, but I feel like this year is off to a good start.
Hereâs your summary of all things Swift by Sundell from January 2020, some open source news, as well as a mini-article about why I build prototypes. Hope youâll enjoy it â your feedback and suggestions are, like always, more than welcome.
đ Weekly articles
For 154 weeks, Iâve been publishing a new article about Swift every Sunday. These articles were added during the past month:
Writing reusable Swift extensions
A look at what goes into writing type- and protocol extensions that can be reused between different use cases and projects, and what sort of principles that can be good to keep in mind when doing that.
Test assertions in Swift
In this article weâll take a look at various ways that we can assert that our code produces the right outcomes within our unit tests, including how we can create our own assertion functions.
Property wrappers in Swift
Letâs take a look at how Swiftâs property wrappers work, and explore a few examples of situations in which they could be really useful.
Swiftâs closure capturing mechanics
An in-depth look at the various ways that Swift closures can capture the objects and values that they depend on, and how we can control those mechanics.
Remastered: Under the hood of Futures and Promises in Swift
A brand new version of my article about building a Futures and Promises implementation from scratch, completely remastered for Swift 5.1.
đ§ Podcast episodes
The Swift by Sundell podcast is a bi-weekly show featuring special guests from all around the Swift community. You can find it in your podcast player of choice, for example Apple Podcasts or Overcast. These episodes were published during the past month:
64: âEarning the deeper lookâ, with special guest Sean Allen
Sean Allen helped me kick off the fourth season of the show by joining me to talk about interview processes, goal setting, prioritizing projects, and what we might expect from Swift and Appleâs developer tools in 2020.
65: âTools are just appsâ, with special guest Gui Rambo
On this special Stacktrace cross-over episode of the show, Gui Rambo joined me to talk about building custom developer tools, how open Appleâs tooling really is, writing âSwiftyâ code versus shipping great user experiences, and much more.
âïž Swift tips
I love to share shorter tips, tricks and techniques with the community. These are the tips I shared during the past month:
Using Self to refer to enclosing types
Making extensions on generic types more compact using the Self
type.
Resultâs convenience APIs
A look at some of the APIs that Swiftâs built-in Result
type ships with.
â Basics
With the Basics series, my goal is to build up a comprehensive library of articles that cover most of the core aspects of Swift and iOS development. This article was published during the past month:
Access control
An overview of Swiftâs five different levels of access control, how they work, and when each of them might be useful in practice.
đș Swift Clips
Introducing Swift Clips, a brand new series of shorter YouTube videos about Swift tips and techniques. This first video was published during January, and more will follow in February:
First class functions
In this first episode weâll take a look at first class functions, which is a language feature that enables us to use functions in really powerful ways.
đ Open source news
Itâs always really hard to know how an open source project will be received by the community. After all, so many open source projects (mine included) start out as simpler tools built for very specific purposes â so even though such a tool might be redesigned to become more generally applicable before sharing it, you can never really know whether other developers and teams will actually find it useful.
Thatâs why Iâm so incredibly happy to see my suite of Swift static site generation tools â Ink, Plot and Publish â not only be used by many developers around the world, but to also see so many people contribute back to them. In fact, within the two first months since I started the process of open sourcing them (starting with Ink at the end of November), over 90 pull requests have been merged â which is truly incredible to see.
There are still a lot of improvements to be made, of course, but I think these three tools are off to a great start â which makes me feel like all of the hard work that went into generalizing them to become proper open source projects was totally worth it.
đ Behind the scenes: Why I build prototypes
I absolutely love prototyping. Not only because it lets me validate an idea or solution without first having to build a production-quality implementation of it, but also because it lets me learn new techniques and technologies by solving actual problems.
Earlier this week, I shared a short video of a Swift editor prototype thatâs capable of auto-generating data models based on how theyâre being used. Thatâs a concept that Iâve been thinking about for years now, but it always felt like an impossible task â something too big and too complex for me to solve as a single developer. However, once I actually sat down and made a list of what building a basic version of that concept would require, my thinking quickly started to shift.
It turned out that I already had all of the parts needed to solve my problem â perhaps not in a âproduction readyâ kind of way, but in a way that would let me explore the problem by building a prototype. Cocoaâs NSTextView
is all thatâs needed to implement a fully capable text editor on the Mac, and I already had Splash for syntax highlighting â a task which requires identifying code tokens like types, properties and function calls.
So to build a quick prototype, all that I needed to do was to put those parts together, to inject a little bit of logic into Splash to make it capture all types and properties that were encountered during the syntax highlighting process â and to then generate implementations based on that data. Done!
Thatâs why I build prototypes. More often than not, they let me prove to myself that a problem turned out to be much simpler than what I first expected, at least when it comes to building a very first iteration of a solution â which can contain as many shortcuts and âhacksâ as it needs to. After all, I donât intend to share my prototype code with anyone, or to use it to build any shipping products, and just that fact alone can be incredibly liberating â as it lets me explore new techniques, solutions and ways of thinking without a lot of constraints.
đ Until next time
Thatâs it for this edition! I hope you enjoyed this newsletter. Like always, Iâd love to hear your feedback â so feel free to either email me, or contact me on Twitter @johnsundell. I read every single piece of feedback that I get, and I try to reply to as many people as I possibly can.
Thanks for reading! đ