How stuff works
Standard cells: Looking at individual gates in the Pentium processor
I’ve been enjoying Ken’s (@kenshirriff) threads and articles about chips.
This one goes into how the Pentium chip is designed, and what blew my mind was that in the 1970s, it was not uncommon to manually lay out every transistor individually, fitting transistors together like puzzle pieces to optimize their layout.
Imagine having to re-do a layout when you find out you're out of die space - which happened to the designer of the Z80 processor.
Thankfully, some smart people came up with the idea of creating libraries of re-usable blocks (or cells) to implement gates, flip-flops, and other low-level components.
This is a great write-up that goes into a lot of technical detail about how processors are structured, and how the individual components work. Definitely worth a read, even if you're not planning to build your own processor.
Using electrical debonding for battery replacement
When I first saw this, I thought it was a hoax. But it seems like Tesa has a wide range of adhesive solutions that allow Debonding on Demand.
Electrical debonding technology uses a special layer in the adhesive tape that reacts to a low-voltage electric current. This current causes a change in the layer, making it lose its stickiness and separate from the surfaces it's bonded to.
Swift
Repository design pattern in Swift explained using code examples
The repository design pattern allows you to create a clean separation of concerns for the data layer in your apps. I've been using it many (most?) of my apps and tutorials, for example this one that shows how to replicate Apple's Reminders app.
In this article, Antoine walks us through the basic principles of the repository design pattern and shows how to implement it using a protocol-oriented approach, which allows you to create specialised implementations, for example an in-memory version that can be used during prototyping an testing, and another one that makes use of UserDefaults
.
SwiftUI
Creating a moving ants animation with SwiftUI
Sometimes you need to think outside the box, quite literally.
Super-powered string interpolation in Swift 5.0
I recently had to display a four-digit number in a Text
view, making sure it gets rendered as a year. Unfortunately (and quite surprisingly, actually), SwiftUI seems to think that 2024
should be rendered as 2.024
...
Paul's (@twostraws, @twostraws@mastodon.social) article came in handy, allowing me to format the year inline, like this:
Text("Released: \(format: releaseYear, using: .none)")
Of course, it covers much more than formatting just numbers, and - not surprisingly, the code snippets feature Taylor Swift.
Swift on the Server
Serverside Swift mit Johannes Weiss
I usually only include links to English resources, but this was too good to not include it. So, my apologies if you don't speak German.
In this episode of the programmier.bar podcast, hosts Dennis and Jan interview Johannes Weiss (Twitter: @johannesweiss, GitHub: weissi), who works at Apple on distributed systems and infrastructure for their AI/ML systems.
This is great interview, touching on many of the key tenets of Swift as both a general purpose and systems programming language.
Towards the end of the episode, Johannes provides some insight into how Apple uses Swift on the server in their own systems, and the private cloud compute for Apple Intelligence is just one of many systems that make use of Swift.
Developer guide to Swift AWS Lambdas
If you'd like to give Swift on the server a go, Pol's (Twitter: @polpielladev, Mastodon: @polpielladev@iosdev.space) article has everything you need. He goes over writing a simple Lambda function, listening to events (for example, when a file is uploaded to S3), how to run the function locally, deploying it manually, and - of course - using a GitHub Actions-powered CI/CD pipeline.
(Side note: the only thing that's missing from this excellent post is a navigation outline, Pol.)
Software Engineering
Latency Numbers Every Programmer Should Know
This is a great visualisation of the data presented by Jeff Dean in his paper "Software Engineering Advice from Building Large-Scale Distributed Systems" (PDF).
A really useful resource to have handy when trying to figure out what's the expected latency of a piece of code. h/t to Johannes Weiss (@johannesweiss) for mentioning it in episode 158 of the programmier.bar podcast!
AI and ML
Exploring Indie Life: Reducing Friction with Cursor
You might have come across Cursor, the self-proclaimed AI code editor. It can answer questions about your code and even modify your code based on your prompt. It's seriously impressive, you should check it out.
In this article, Rudrank (@rudrankriyam) describes how he set up Xcode and Cursor to keep editing in Cursor without having to switch back to Xcode for running the application. This works thanks to the magic of @merowing_'s Inject, which powers a hot-reloading experience.
I've tried this out myself, and the results are quite impressive - if things work as intended! However, even a relatively simple "make this list of movies searchable by movie title" results in three different implementations, and only one of them was correct.
Productivity
How to use EditorConfig files in Xcode
This is something that comes in really handy if you're working on different code bases with teams that use different indentation schemes.
Also - did you know that swift-format is now included in Xcode 16 and higher (see the Xcode release notes)? Seems like you can even invoke it from inside Xcode.
Fun stuff
Paris, but differently
When you think you've seen everything, here is a guy who re-creates Paris from electronic components.
Comment
The (AI) world is moving a break-neck pace, and it seems like each week new products get released that were previously next to impossible to implement. I was really impressed to see what people were able to achieve with tools like Cursor - an AI powered code editor.
I've tried it out myself on a sample app for Firebase Data Connect that I am currently working on, and the results were quite promising. Nevertheless, I still had to know what I was doing, so the tool was mostly a convenience for me. Oh - if you are in the private preview program for Firebase Data Connect, and would like to provide feedback, please drop me a line - I would love to hear your thoughts about the APIs, specifically for Swift.
Some of the posts in this newsletter are inspired by my work on this sample app - I'll leave it up to you to figure out which ones.
In related news, we've started running a regular livestream in which we experiment with technology (mostly Google Cloud and Firebase) and talk with product managers, software engineers, and other people from developer relations. This week, we took a closer look at Gemini in Firebase. You can watch the recording here: Firebase After Hours #5 - Stop coding, start asking: Gemini in Firebase.
Peter Friese