Re: Sub-50ms AI in Swift: System One Decisions & 55+ Polished SwiftUI Components
Hi everyone!
First off - apologies for sending out multiple copies of the previous issue. That wasn’t some sort of shrewd growth hack on my part - I actually f*cked up. I’ve since implemented a couple of guardrails to prevent this from happening again. So thanks for sticking with me and not hitting unsubscribe!
I don’t know about you, but my social feed was full of Jev and System One models over the past few weeks. “System One” is based on Daniel Kahneman’s concept of fast, intuitive thinking - the idea being that these types of models can make ultra-fast, deterministic decisions. And since software is all about decisions, this comes in very handy. So even though I was officially on vacation, I put together a Swift package for Jev (and other System One models). As an example, I implemented an email triage feature for a native macOS app - it can triage 500 emails in less than a second!
Many of you are working on updating your apps for the new iPhone Duo, and in addition to Apple’s videos and other resources, there are now third-party resources and guides available, such as a skill that helps your coding agent to follow Apple’s Human Interface Guidelines.
We’re in the middle of conference season, and I’m looking forward to connecting with many of you in person over the next few months. Here’s a quick overview of where you can find me:
swiftCon / agenticCon (October 7-9, 2026): I’ll be running a workshop about agentic coding, and giving a talk about AsyncStreams in Swift
Do iOS in Amsterdam (November 10-12): I’ll be running a workshop about Apple’s Foundation Models and Firebase AI Logic, and giving a talk about hybrid AI with Apple’s Foundation Models framework.
If you’re at any of these conferences, please come say hi! I’ve got Firebase stickers and socks, and I’m always up for a chat about Swift and AI agents.
Enjoy this issue (just the one copy, I promise!), and let me know what you’re building - just hit reply!
Cheers,
Peter
Sponsor this newsletter: Reach 1,960+ Swift and Apple platform engineers with your product, project, or event.
View available dates →
System One models like TypeSafe’s Jev are smart if statements: you pass in some context and a couple of questions, and they send back an answer for each question in just a couple hundred milliseconds.
In software systems, we typically use if-then-else statements or switch statements to codify decisions. This works well when the outcome can be computed using boolean logic, but it falls apart when you need to make a judgement call. Is this support ticket urgent? Is the sender of this email unhappy? Should we issue a refund?
LLMs can help with decisions like these, but they are relatively slow and expensive, especially when you need to make thousands of them. System One models solve this: they skip token-by-token text generation entirely. Given an input state and bounded questions with predefined answer types (choice, score, noul), they predict probabilities across your questions in a single forward pass, returning a typed decision without hallucinations.
In my latest blog post, I show how these primitives map directly to Swift enums, ranges, and booleans, and how you can integrate them seamlessly with Apple’s Foundation Models framework using a custom LanguageModel session.
If you’ve been using UIScreen.main in your app (for example to get the root view controller), now is the time to stop doing this.
There are a couple of other important changes to how safe areas and scenes work.
And there are some genuinely new concepts like the reserved regions (like the camera and the hinges), and some APIs that will make for some fun new interactions, like the hinge API (any bets on how many “creaking door” apps we’ll see?).
This is a great summary and definitely worth a read.
Analysing images is a great use case for AI. Majid shows how Apple’s Foundation Models framework makes this straightforward by using a Swift result builder.
This works both on-device and when connecting the framework to one of the cloud-based models, such as PCC, Claude, or Gemini.
SwiftPieces is a library of 55+ SwiftUI components that are highly polished. They look absolutely stunning, and use animations and haptics for that extra premium feel.
Instead of having to add yet another dependency to your app, you just copy individual Swift files to your project to add components, similar to ShadCN.
An agent skill is included to make it easy to use with your favourite coding agent.
In addition to the free components, there’s also SwiftPieces+, which includes an impressive number of professionally designed screens that build upon the individual components.
When working with coding agents, you can watch them think about the current task. While this can be fun and often quite insightful (I’ve learned a thing or two from reading those streams of consciousness), it’s not always efficient.
Quite often, the task at hand requires the model to make a judgement call. And that’s not always worth spending all those tokens on thinking and then returning a verbose output.
Using a decision model like Jev can make this a lot cheaper (0.42 USD cents per million token input, output is free), and efficient (Jev answers in about 50ms to 300ms).
Sai Rahul explains how you can set up an agentic coding environment using Codex in which Jev decides which model and thinking level to use, and what the next step should be. And of course you can apply this to any other agent as well.
I’ve been a long-time fan of Hard Fork, in which Kevin and his co-host Casey Newton discuss the latest developments in AI and tech in general. The podcast originally set out to cover crypto and blockchain topics, but quickly pivoted to AI once it became clear that this was going to be the major disruption of our times.
Kevin knows a thing or two about AI (yes, he’s the guy whom Sydney urged to divorce his wife), and this excerpt is a great teaser for the book. Can’t wait to read it!
Thomas Ptacek writes “So, first the bad news: you have to write for yourself.”
I don’t agree this is bad news. To me, writing is thinking, and using an LLM to write for me means I’m depriving myself of the chance to think about what I want to write about.
Thomas would probably agree with me on this - his recommendations, for example, to use LLMs as copy editors, not ghostwriters, are excellent.
I’m definitely going to check out the book recommendation (Style: Lessons in Clarity and Grace), and the prompt for the editing tool he proposes also looks very cool.