Computer History
Q: Setting User-Agent Field?
Before we had StackOverflow, people used to ask questions on the Usenet. Here is a question by one Lawrence Page, who you might better know as Larry Page, one of the co-founders of Google, about the User-Agent field of Java. One of the earliest public signs of what later became Google (see this Wikipedia reference for more details).
Swift
WWDC Notes
Apple released 175 new videos at WWDC this year. That is an insane amount of content, and watching all of those videos would take you much longer than a week (if you assume an average duration of 30 minutes for a video, that would amount to almost 90 hours of content, and even if you tried binging this away around the clock, it would take you more than 3 and a half days...)
It should be obvious that this isn't sustainable. So what can you do? Short of using Google's Bard or ChatGPT, you can head over to WWDC Notes, and check out the notes and summaries that the community has put together. It's an excellent resource for getting a quick overview - and if you notice the summary for your favourite session is missing, you can just contribute one yourself.
ailtonvivaz/SwiftRequest
Here is one of the very first Swift packages that make extensive use of Swift's new macro system to make an existing API easier to use. Ailton Vieira uses a smart combination of attached macros and property wrappers to enable you to write REST clients.
Here is how you'd define a simple service for fetching quotes:
@Service
class QuoteService {
@GET<[Quote]>("quotes/random")
private func getRandomQuotes(@QueryParam("author") authorSlug: String? = nil) {}
@GET<Quote>("quotes/{id}")
private func getQuote(@PathParam by id: String) {}
}
@Service
and the REST verbs (like @GET
in this example are attached macros, whereas @QueryParam
is a regular property wrapper.
This is really exciting stuff, and it's going to be interesting to see all the other use cases people will come up with.
An App Group roller coaster ride
App Groups allow multiple apps developed by the same team to share data. They also are one way to set up sharing authentication between multiple apps (or an app and its extensions) in Firebase Authentication.
They are notoriously difficult to set up. In this article, Daniel shares how he ran into an issue when sharing data between a keyboard extension and its main app. There are some interesting lessons that might help you debug issues when using App Groups in your own apps and extensions.
What’s new in Swift 5.9?
Swift 5.9 has a bunch of quality-of-life improvements (such as if
and switch
expressions) that will make it easier to write cleat and concise code. But there are also larger changes, like the addition of Swift macros. Paul walks us through them, explaining everything with a copious amount of code snippets.
SwiftUI
What is new in SwiftUI after WWDC 23
Majid came out with a first quick look at what's new in SwiftUI on the day after the Platforms State of the Union.
It's a good overview with a bunch of code snippets, and I expect we will see many new articles from around the community about specific APIs and the inevitable rough edges they still have.
It's definitely worth checking out Majid's Twitter timeline - he's covered a bunch of additional SwiftUI aspects that he didn't include in his article.
What's new in SwiftUI iOS 17 at WWDC23
Khoa has another rundown of everything that's new in SwiftUI, with lots of code snippets and screenshots to go along them. It's a good summary to get up to speed with all the news in SwiftUI this year.
Again, check out Khoa's Twitter feed, there's a bunch of extra tips and tricks!
How to Define Custom URL Actions for SwiftUI Text Views
You might know that - thanks to Markdown - you can define URLs on your Text
views. Here is great article by SwiftSenpai that shows some tips and tricks how to customise those links to do cool stuff like triggering actions inside your app (instead of opening the URL in a browser), or triggering analytics event.s
Productivity
Just a handy command-line tool
As developers, we often use different build tools: npm, yarn, make, plain shell scripts, or even custom-made Swift scripts.
Each tool has a slightly different syntax, and it's often hard to remember how exactly you can build your frontend or start the server in development mode.
With just
, you can define your own commands and use them across all sorts of other build tools you might be using. And just like that, you can use just run
to run your server or just build
to compile your client. Or, why not use just console
to jump to the respective management console, no matter if it's the AWS console, the Firebase console, or the Google Cloud console.
Developer Duck - Pair program with yourself!
You might be familiar with the term Rubber duck debugging - the general idea is that by verbalising your ideas (to a real or imaginary rubber duck), your brain is capable of identifying the flaws in your code more easily.
Developer Duck takes this idea and sprinkles some AI on top. It's a standalone macOS app that uses OpenAI's ChatGPT APIs with some pre-tuned prompts to help with developer-focused tasks.
Add xcuserdata to your .gitignore file
Here is a quick tip from Marina's iOS Code Review newsletter (which I highly recommend, by the way). You might know that you app's .xcodeproj
file actually is a folder, and it contains a bunch of really useful files that help Xcode maintain the structure of your project, and keep track of things like your breakpoints and the layout of your IDE. But some files just add noise when checking them in - the xcuserdata
folder is one of them.
Web
Safari (for Mac) URL Scheme
Like many other apps, Safari has a couple of URL Schemes that come in handy at times. For example, when you want to make sure a specific URL is opened in Safari, no matter the user's default browser.
Christian also walks you through how to discover URL schemes in other apps.
Comment
What a week it has been!
Apple launched Vision Pro, and dropped a whole slew of new and updated APIs on us (Marco has a very useful overview of all new frameworks presented at WWDC23)
Like many others, I wasn't lucky enough to win a ticket in the lottery, but it seems like those who did had a great time at the main event, trying out Vision Pro, the talk show, and the many community events!
I am in two minds about Apple Vision Pro: from an engineering standpoint, this is a marvel of technology, and the people who worked on it should rightfully be proud of what they've achieved. I very much look forward to trying it out myself once it becomes available in Apple stores. And I am curious to see all the amazing ideas will implement for this new computing platform (I've got some ideas myself).
However, I am very sceptical about the impact a device like this will have on the human-to-human interaction.
I agree with Nilay Patel - Vision Pro very much feels like a development platform that Apple wants to use as a device that has a maximum of capabilities to see what developers built with it, so they can see see what "sticks to the wall". Once it becomes clearer what the use cases are, this will move into one or more different directions. I wouldn't be surprised if the future of spatial computing was not wearing goggles, but rather glasses, which would be a lot less intrusive.
What do you think, and what are you most excited about? Let me know by hitting that reply button!
Peter Friese