What I am working on
Interactive Tutorials for SwiftUI & Firebase
I've started working on a set of interactive tutorials for SwiftUI and Firebase.
Judging by the reactions to my tweet this week, people seem to be really excited about this, so I thought I might just make this available as I make progress.
I use DocC for creating these interactive tutorials, and it's generally a great experience: you write content in an enhanced Markdown syntax that allows you to link to additional resources such as images and videos. But the main feature of DocC interactive tutorials is how you present source code: instead of using fenced code blocks, you link to source code files that reflect the individual steps of the tutorial, and DocC will automatically use the diff between the files to highlight the parts of the code that the user has to add or change.
If you want to give it a try, check out the first part of the tutorial which walks you through creating the data model and UI for a simple todo-list app: Building a Simple Todo List UI.
Eventually, this will become a full replica of Apple's Reminders app, with the users' data stored in Cloud Firestore, attachments stored in Cloud Storage, and user authentication implemented using Firebase Authentication (supporting Anonymous authentication, Sign in with Apple, Google Sign-In, Email/Link authentication, and Email/Password authentication). See the outline for more details.
If you find any issues or typos, feel free to file an issue on the repo.
Firebase
Trim your JavaScript bundles with Firestore Lite
Every byte counts when your web site or web app is popular and you want to make sure all of your users can enjoy your app - even if they are on a slow (or expensive) connection.
In this blog post, Christina Holland shows how you can use Firestore Lite to reduce the size of your JavaScript bundles to speed up downloading of your app.
One of the reasons why Firestore Lite is significantly smaller is the fact it doesn't include support for realtime listeners. These require gRPC, which is a pretty heavyweight dependency.
But what if you want to benefit from a smaller bundle and use realtime listeners at the same time? Christina explains how to have your cake and eat it, too!
Computer History
Introduction of the iPhone SDK
15 years ago, on March 6th, 2008, the iPhone SDK was introduced at the Apple Special Event 2008.
It's really something to see Scott Forstall talk about all the effort Apple has put into making Web Apps "even better", before he goes on to explain what the iPhone SDK is. One of the moments that neatly summarises how far we've come since then is when Scott talks about how Xcode integrates with your source control management system and you can see Subversion, CVS, and Perforce in the screenshot.
The Wikipedia article for the iOS SDK points to two news articles from the time. In Apple unveils iPhone SDK, Jim Dalrymple writes rather dryly:
Among the tools available to developers will be SQlite, a built-in database system, and Core Location, which uses cell tower and wi-fi base station data to determine your phone’s geographic location.
I urge you to watch the entire video - the segment in which Scott walks the audience through building three different apps, running them on device, and using Instruments to optimise one of the apps nicely demonstrates what a breakthrough moment this was for mobile development.
Today, we take those features for granted, and as Scott repeatedly states in his talk, we stand on the shoulders of giants to build even better apps today.
Thanks to David Barnard for digging this out.
Swift
How to make an interactive picker for a Swift command-line tool
As Swift.org states, "Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns". Most of us use it for developing mobile apps, but it's also great for developing command line utilities.
Pol has started porting clack to Swift, and I can promise you: after seeing it in action you will want to create a CLI - it looks that good.
SwiftUI
ViewStateController: Reusable State Management for SwiftUI
Most apps need to display some sort of intermediate state when loading information from across the internet. In a typical SwiftUI app, you might find code like the following:
switch viewModel.state {
case .initial:
EmptyView()
case .loading:
ProgressView()
case let .loaded(fact):
Text(fact.fact)
case .error:
Text("Error")
.foregroundColor(.red)
}
While this is easy to understand, it adds a lot of noise, especially if you need to apply this to multiple UI elements.
Manuel has been working on a package that makes this easier: ViewStateController. In this blog post, he explains the rationale behind it, and how he built it. Everything is configurable and well documented. Definitely worth checking out.
AI and ML
Introducing ChatGPT and Whisper APIs
Earlier this week, OpenAI released ChatGPT and Whisper APIs, and it seems this has unleashed a plethora of tools that bring LLMs to all sorts of environments.
Here are just a few that I came across this week:
Earlier, Ronith built a tool that allows you to summon AI autocompletion by typing +++
anywhere. This is pretty similar to what the Raycast team have recently announced. If you're a Raycast user, you should definitely give it a try. Not only are the default AI commands really useful on their own, but they also allow you to pass the result of a command to another AI command. Check out their video for more details.
Tools
Pimp My DocC Documentation
This is super timely, and I will try to set up some time to play around with this to see if I can style the interactive SwiftUI & Firebase tutorials to match the Firebase branding.
aheze/Squirrel: Enable scrolling in the Xcode Simulator
This is a nice little menu bar app that enables scrolling in the Simulator.
Comment
Note: This newsletter was entirely written by a human, without any AI assistance. By the end of the newsletter, you will understand why I felt compelled to say this.
This week, Mark Moeykens ran an interesting experiment: he asked people to tell him one very specific thing about Swift that is super difficult to grasp, and then wrote a blog post about that topic.
I replied "Syntax of if case let", and was surprised to see Mark had written a new blog post literally just a few hours after that.
The post is written in a style that is very similar to Mark's typical style of explaining complicated topics in everyday concepts (which I really like), so I didn't think much of it. But there was something that felt odd, and I couldn't quite put my finger on it. It turns out Mark used Bing's new AI features to write not just one, but a whole bunch of articles. All articles now include a disclaimer saying
Note: Portions of this blog were AI-assisted.
, which is in line with Medium's new AI policy (covered by The Verge in this article).I've used AI tools to summarise articles, or to help me come up with ideas and sometimes even to improve my writing. But I've always felt that the majority or a piece of content should be created by a human being. What's your opinion? Let me know by replying to this newsletter, or tweet at me.
Conferences
In other news, the conference season is in full swing, and I am thrilled to be speaking at the following events:
For an extensive list of iOS-related conferences, check out iOS Conferences for Mobile Developers in 2023 by the Kodeco team.
Apart from speaking at the above conferences, some of my words might or might not be part of the Firebase sessions at Google I/O 2023, taking place on-site with a limited audience in Mountain View, California and online on May 10th.
It sure looks like this is going to be a busy year :-)
Peter 🔥