What I am working on
Previewing Stateful SwiftUI Views
I am working on a couple of reusable SwiftUI components at the moment, and one thing that I found increasingly annoying is that you cannot use interactive SwiftIUI previews once your views make use of @Binding
to connect to data that is owned by one of the owner views.
The typical way out is to use .constant
to pass in a constant binding, but that makes it immutable. So I did some research to find a better way, and documented it in this blog post to save future me some time.
Hope you find it useful as well!
Firebase
Authentication and onboarding | Better Safe than Sorry
I recently had the chance to catch up with Roman Nurik to chat about the UX of authentication and onboarding. This is a fun episode of Better Safe than Sorry in which we touch on a couple or really important topics, such as zero state, which aspects to consider when choosing an authentication mechanism for your app, and ... the Nascar problem! Watch it here.
Add Firebase to your Flutter app
In this learning pathway, you will learn how to use Firebase features for Flutter, including user authentication, data deletion, feature flagging, and crash tracking.
Swift
Using WebSockets to Build a Realtime iOS Model Inspector
Do you remember PonyDebugger? It's a debugging tool that allowed you to connect Chrome DevTools to your running iOS app to do all sorts of interesting things:
- Inspect network traffic
- Browse Core Data
- Inspect (and modify) the view hierarchy
- Remote logging
Ryan Ashcraft built a similar tool that allows you to inspect Codable
model values in realtime. Great idea, and I would love to see more like this!
SwiftUI
Providing a default value for a SwiftUI Binding
View models or models often have optionals, which makes it hard to bind them to SwiftUI. I often run into this situation, and usually end up making the respective property a non-optional. However, it's not always possible to do this (for example, if the code is part of an SDK you use). And even if you can change a property to a non-optional, there probably was a reason why it was defined as an optional in the first place.
In this article, Donny shows how to create a custom Binding
that allows us to define a default value for an optional property. Really handy in many situations, and I will definitely be using this in my apps.
Understanding SwiftUI view lifecycles – Ole Begemann
Understanding the SwiftUI view lifecycle is essential, especially when interfacing with other parts of your system. Ole wrote an app called SwiftUI View Lifecycle that allows you to observe how different SwiftUI constructs and containers affect a view’s lifecycle, including the lifetime of its state and when onAppear gets called. Great for exploring and developing a deeper understanding of SwiftUI.
MarkdownUI: Render Markdown text in SwiftUI
Need to render CommonMark compliant Markdown in your SwiftUI app? Check out MarkdownUI by Guille Gonzalez!
AI and ML
Will ChatGPT Destroy iOS Developer Jobs? A Demonstration
Sean Allen builds a SwiftUI app to display his GitHub followers using ChatGPT. Seems like he was more successful than I was last week (when I tried to create a todo-list application based on SwiftUI and Firestore).
m1guelpf/plz-cli: Copilot for your terminal
Can't remember the syntax for a particular bash command? plz-cli (by Miguel Piedrafita) generates bash scripts from a human-readable prompt. And yes - you guessed it: it uses GPT-3 under the hood.
Chatting with ChatGPT to build a chat app for ChatGPT
A couple of folks have started building apps to make chatting with ChatGPT easier. Here is Vatsal, building an iOS chat app in public. He's using ChatGPT to work out some of the issues he's running into. Very meta.
Tools
Improve Debug Output | Xcode Tips
This is a nice little tip from Dominik Hauser that will make your debugging experience in Xcode a lot better.
I'm probably not the only person who totally forgot that you can change the formatting of the Debugger Console Output. Doing this will make it easier to tell apart any output from debug breakpoints (you knew that you make your breakpoints print to the console, didn't you?) - all other debugger output will also be colorised. I.e. if you use po <some variable>
, or use the debugger context menu to print the description of an expression in the Variables View.
Now, if only Apple added contex-aware syntax highlighting to the console, so we could have errors or warnings stand out more...
Conferences
Swift Heroes 2023 CfP now open
Swift Heroes (Turin, Italy) is back, and their CfP is now open! What's cool about this conference: it takes place in a car museum, and it is both in-person and live streamed.
I went this year, and had a great time (minus the fact my suitcase didn't arrive in Turin, but that's a different story).
Charlotte and I had the opportunity to give a talk about Firebase and iOS this year - check out the video: 🍏 + 🔥 = ❤️ Firebase for Apple developers
Running Flutter apps on flexible displays
At first I thought this might be super interesting for conferences, but then I had a look at the price tag...
Podcasts
Why still 80 columns? - CoRecursive: Coding Stories
Many development teams have guidelines for how their code should be formatted, and many of these guidelines include a column limit. Often, this will be 80 characters, and some teams are OK with 100 or even 120 characters.
But where do these column limits actually come from? As with many things in life, it has to do with little green pieces of paper...
Comment
As I am reviewing the links I've selected for this newsletter, I can't help but notice that developer experience is at the heart of many of them.
Developer experience (or DX / DevX for short), refers to the overall user experience of the software, tools, and platforms we use to create software. Things like ease of use, performance, reliability, and (!) documentation, are all factors of what makes good DX. Not to forget aspects like support and community resources.
We all know that good UX is important for how efficient users can interact with a software system, and the same goes for the tools we use on a daily basis.
I am still shocked by JetBrains' announcement to sunset AppCode - it had many features that increased the DX of writing Swift code, and I can only hope that Apple continues investing in Xcode (in particular its refactoring tools). By eliminating barriers and making things easier than they used to be, tool vendors can help their users become dramatically more productive.
SwiftUI is a great example. Building even elaborate UIs is so much easier in SwiftUI than it used to be in UIKit (just try building a simple
UITableView
in UIKit and compare it to the sameList
view in SwiftUI). Not only has Apple increased the productivity of app developers on their platforms by several factors - they've also made developing on iOS, iPadOS, macOS, watchOS, and tvOS much more approachable for everyoneGood developer experience is essential for the success of every ecosystem, and I hope that Apple adds some of AppCode's most loved features to Xcode. It is about time.
As always, I love hearing from you, so why don't you hit that reply button in your email app and tell me what you're missing most in Xcode or Firebase?
Peter Friese