View profile

💬 Regrets, blocks, and quotes - Not Only Swift Weekly - Issue #17

Peter Friese
Peter Friese
Hi everyone 👋🏻
This is the 17th issue of Not Only Swift Weekly. Now you might think 17 is such a random number, and it truly is - ask a couple of people for a random number, and I promise 17 will come up. Maybe it is not such a random number at all… (BTW - it’s no coincidence this newsletter is being sent out at 17:00 CET)!
Anyway, this is the final issue for this year, and I am quite amazed I managed to write something every week since I started this newsletter in August 2021. I will now take a short break to recharge, spend time with my family, and work on another project that I will talk and write about more in the next year, so stay tuned!
Thanks for being a subscriber, it really means a lot to me!
If you like the newsletter, share it with a friend by email, and if you haven’t done so already, follow me on Twitter and subscribe to my YouTube channel - I’ve got a bunch of exciting things coming up next year, so make sure to not miss out!
Thanks for reading, and if you celebrate - Merry Christmas!
Peter 🔥

What I am working on
I’ve almost finished migrating my blog from Gatsby to Publish - both the landing page with the list of all blog posts, as well as the posts themselves now can be generated entirely using Publish using my own custom Publish theme 🎉
This week, I spent some time on implementing custom info boxes:
In the past, I’d been using blockquotes (using > in Markdown) to call out important sections of my posts. I’ve always been mildly disappointed with how they looked, and was always hoping I’d be able to spice them up a bit to make them look more visually pleasing.
One of the things that’s pretty cool about Publish is that you can adjust the way how it parses Markdown, thanks to it making use of Ink, John’s very own Markdown parser. To modify the parser behaviour, all you need to do is register a Modifier. This then allows you to inspect both the Markdown and the generated HTML and make any adjustments needed. So in order to define my own info boxes, I decided to add |{INFO} to the beginning of a Markdown blockquote, for example like this:
> |{INFO} This is an info box
The result will be rendered like this:
My plan is to support several kinds of info boxes, such as info, quote, warning, etc. This should be easy enough to implement, and will mostly require different CSS styles for the rendering.
Unfortunately, I also ran into some issues with the way blockquotes are parsed in Ink. Even the latest official version doesn’t support embedded environments, such as lists, headers or images inside of blockquotes. I guess John doesn’t use any of these on his own site. On my blog, I make liberal use of this - for example, in this article, I’ve got a side bar which explains how to unlink your Apple ID when implementing Sign in with Apple, and I included a bunch of screenshots in the blockquote. This didn’t render correctly with the official version of Ink, unfortunately.
For a brief moment I thought this was the end of my experiment to replace Gatsby with Publish. However, Rob Mecham sent a pull request adding support for most elements a while back, so all I had to do was merge this into my private fork of Ink (making sure to keep the support for Markdown tables which was added after Rob’s PR), and implementing a fix that allows me to continue a blockquote after a list (another feature I found I use quite a bit in my blog posts).
If you’re interested to see the new site in action, you can visit the preview channel - the site runs on Firebase Hosting, so it’s super easy to publish a preview without affecting the production version of your site - you should definitely check this out. Here’s a quick video that shows how it’s done.
Are you interested in learning more about how you can build a static site using Publish (and host it on Firebase)? Let me know what you’re most interested in!
With Apple backporting Swift’s Structured Concurrency and async/await to iOS 13, macOS 10.15, tvOS 13, and watchOS 6 or newer, we can all now use async/await and friends in most (if not all) of our apps. 
But obviously, framework owners need to make sure their SDKs support async/await as well. Tjeerd has written an article about what to look out for if you’re a module owner and you want (or rather, need) to support async/await: Supporting async/await as a module owner
John has just published a nice little Swift package (JohnSundell/AsyncCompatibilitKit) that plugs some of the holes in Apple’s own libraries and adds support for async/await for a couple of APIs that are lacking them in earlier versions. So, if you ever wondered how the task view modifier in SwiftUI is implemented, now you can at least look at one possible implementation
Swift is a pretty cool language with modern concepts, and you would think that - given the language’s open evolution process - it should be free of flaws, right? Well, if you’ve been following Jordan Rose (who worked on Swift from pre-release to Swift 5.1), you might have seen his series of Swift Regrets - things he wishes he (and the team) had done differently. Jordan has now published all of his tweets (both regrets and delights) on his blog - enjoy: Swift Regrets
Alexandre Colucci has put together a great article analyzing Apple’s use of Swift and SwiftUI, and while the charts indicate a continuous growth of the apps using either (or both), there is another chart about the evolution of programming languages used in iOS, and it shows Objective-C is still going strong!
Number of binaries using which programming langugage
Number of binaries using which programming langugage
The accompanying Twitter thread has a lively discussion going:
There are a ton of resources out there to get started with SwiftUI, but did you know Apple’s Documentation has an entire section with sample apps? Nicely organised by topic (Navigating Apps, Presenting Content, Retrieving Content from a Server, Responding to User Input) and built using Apple’s scrolling tutorial viewer. Definitely worth checking out!
Whenever I need to exercise an API, or built one myself, Paw is my go-to app on the Mac. But what if you need to urgently make some REST calls while on the go? Well, HTTPBot is here to save the day! Beautifully designed, available on iOS, iPadOS, and macOS. It even supports widgets!
🤯 Mind blowing stuff
Redstone circuits are a concept in Minecraft that lets you activate or control mechanisms. People have created all sorts of contraptions using Redstone, but this Redstone CPU is quite something. The video shows how it capable of running some simple games like Tetris or Snake. Quite impressive, even if you keep in mind that the video had to be sped up to actually be able to make the games watchable in real time.
CHUNGUS 2 - A very powerful 1Hz Minecraft CPU
CHUNGUS 2 - A very powerful 1Hz Minecraft CPU
Did you enjoy this issue? Yes No
Peter Friese
Peter Friese @peterfriese

Xcode tips & tricks, Swift, SwiftUI, Combine, Firebase, computing and internet history, and - of course - some fun stuff.

In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Created with Revue by Twitter.