Firebase
Send SMS Messages with Cloud Functions for Firebase Gen 2
Cloud Functions for Firebase allow you to create backend functionality for your apps without having to worry about setting up, running, and maintaining a server.
In this article, Amanda Cavallaro (@amdcavallaro) shows how to send and receive SMS in Cloud Functions via the Vonage Messages API and the Firebase Realtime Database (RTDB).
If you either don't like writing code in TypeScript, or you are in a rush, there is a Firebase extension that makes sending messages using Vonage even easier.
How stuff works
The Challenges of Cross-App Copy-Paste and Our Solutions
Being able to copy and paste a piece of information (be it a simple text, an image, or even a more complex aggregation of multiple different media) from one app to another is something that we take for granted, and maybe we marvel at the fact you can easily copy and paste from your iPhone to your Mac. But there is a surprising amount of work that needs to happen to make this a really good experience for users.
In this article, Peter Wiesner (@peter_a_wiesner) takes us behind the scenes of how they made sure you can properly copy and paste to and from the Craft app.
Swift
Lesson learned from Chris Lattner on Swift
If you're ever feeling that Swift is becoming more and more complex over the years, you're not alone:
"Swift has turned into a gigantic, super complicated bag of special cases, special syntax, special stuff, and - it's all locally well-intentioned, [...] but one of the challenges that Swift ran into [...] is that it scaled the user-base really quickly. [...] so the whole team was behind, and then, instead of fixing the core, [,,,] they started adding all those special cases." - Chris Lattner (@clattner_llvm).
This clip is part of a longer interview with Chris on the ThePrimeTime show, in which Chris shares some insights on how Swift grew from what essentially was a weekends and nights project into a language that is used by millions of developers around the world. Worth watching to hear more about Chris' learnings from building and growing a popular programming language, and which of these he's applying to Mojo - the new programming language Chris has been working on after he left Apple.
A Swift Tour: Explore Swift’s features and design
If you're overwhelmed by Swift's syntax, this WWDC session might be a good refresher. It goes over the essential features and the design philosophy of the language, and explores how to model data, handle errors, use protocols, write concurrent code, and more.
h/t/ to Angelica (@aabato1) for sharing!
SwiftUI
Quality of life improvements for SwiftUI
In the latest release of SwiftUI, Apple introduced a bunch of quality of life improvements (check out the What's new in SwiftUI session, particularly the Ease of Use section.
Here are three additions to SwiftUI's previews that will make your life easier.
@Previewable: Dynamic SwiftUI Previews Made Easy
One of the most amazing features of SwiftUI is that you can interact with a live preview in Xcodes preview canvas (which seems to work better the beefier your machine is).
However, when you want to preview a view that relies on a dynamic property, you had to jump through a couple of hoops to make this work (I wrote about this in Not Only Swift - Issue 22).
With the @Previewable
macro, this is now a lot easier. Antoine (@twannl, @swiftlee@mastodon.social) walks you through how to use it - he even used the same example I did back then. Which really goes to show to-do list apps are the "Hello World" of software development :-)
Using PreviewModifier to build a previewing environment
Apple's PreviewModifier documentation states that "Conforming types can define shared contexts that will be cached by the preview system, then reused across participating previews."
While this is its primary use case, you can also use PreviewModifier
to decorate views in your previews.
Donny (@DonnyWals, @donnywals@chaos.social) shows how both of these use cases work, and also provides some feedback about the general usability of this view modifier.
Have you started using PreviewModifier
in your apps? Share your experiences!
Introducing Entry macro in SwiftUI
SwiftUI’s environment is a key component for making view modifiers work. In the past, adding custom environment values was a rather involved process, but with the new @Entry
macro, this becomes a lot easier. Majid shows how to use it.
If you'd like to see how to add custom environment values, check out my interactive tutorial Building Reusable SwiftUI Components Tutorials.
Note to self: need to update the SwiftUI components tutorial for iOS 18.
Productivity
Xcode now supports EditorConfig
According to the Xcode release notes, Xcode now supports several EditorConfig settings:
- indent_style
- tab_width
- indent_size
- end_of_line
- insert_final_newline
- max_line_length
- trim_trailing_whitespace
This is great news for anyone working in code bases that use different indentation settings that the Xcode defaults. Also, I have no idea why trimming trailing whitespaces is not enabled by default in all editors. If you know of any good reasons for keeping trailing spaces, let me know.
Thanks Mateusz Bąk (@MatejkoBak) for sharing!
Security
Why Your Wi-Fi Router Doubles as an Apple AirTag
In issue 62, I included an article that discussed how the Etak navigator used dead reckoning to determine your position based on estimates of speed and changes in direction.
But even these days, GPS is not the only way how your phone determines your location. You might have heard that phones use the SSIDs of nearby WiFi networks to determine your location if it can't get a solid GPS fix (this is one of the reasons why your phone sometimes claims that you are at Paddington when you are en route on the Heathrow Express).
Apparently, this can lead to some security risks, specifically for vulnerable populations, as the article discusses. By appending _nomap
to your APs SSID, you can opt out of having its SSID being used. So here is a question for you - how many networks have you seen in the wild that use this suffix?
Comment
If you've attended any of my most recent talks, you might have noticed that - in addition to talking about how to create reusable SwiftUI components, I've covered more and more AI-related topics.
A few days ago, I had the chance to present a workshop about Genkit, Google's AI integration framework, at the WeAreDevelopers conference in Berlin. Genkit allows you to build powerful AI features and deploy them anywhere you can run an Express.js app - including (but not limited to) Google Cloud and Firebase.
I've been using this to build some AI features (like summarising blog posts and other technical content, or running Q&A against the contents of Firestore database) for a personal knowledge management app, and on August 6th, I will give a talk about how I made Siri smarter with Firebase and Genkit at the NSLondon meetup in London. The code I will present makes use of some of the cool new features in SwiftUI I cover in this issue of the newsletter!
I might also bring some stickers with the new Firebase logo...
Peter