đȘ đșđ» (Magic Move) - Not Only Swift Weekly - Issue #8
Hello everyone,
I hope youâre having a great and productive week! Did you enjoy Appleâs and Googleâs hardware events earlier this week? I am certainly looking forward to cutting down my compile times once I can lay my hands on one of those sweet M1 Pro/Max machines. Although I must admit I was hoping to see them use âtime to unpack Xcodeâ as the benchmark ;-)
This week, Iâve got a fine selection of links about Swift, SwiftUI, Firebase, and presentation tools for you. Firebase Summit 2021 is happening, and there is a bunch of really cool things that the team is getting ready to ship - keep your eyes peeled!
As always, I am keen to hear your feedback, so if youâve got anything youâd like to share with me, just hit that reply button and let me know! Seriously - I do love hearing from you, donât be shy!
Thanks for reading,
Peter
P.S. if youâd like to say thanks beyond subscribing or sharing this newsletter with a friend, you can now send me a coffee through the internet - isnât that amazing?
What I am working on
With Firebase Summit looming on the horizon, I am working on a bunch of things that you will be able to see during the keynote and in the pathways that weâre publishing in the weeks ahead of the event.
One of those things is a sample app for iOS and watchOS. I donât want to spill all the beans here - youâll have to see for yourselves - but the app makes use of a backend that is entirely driven by Firebase and Firebase Extensions. The client app(s) communicate with the backend via Cloud Firestore, which gives us the nice benefit of a near-realtime synchronisation. So when you make a change in one of the apps (say, on the iPhone), this will be reflected on your iPad almost instantly.
Building the frontend for iOS, iPadOS, watchOS, and macOS was really straight forward, since we were able to reuse all of the existing backend functionality. And thanks to the the Firestore property wrapper we recently added (thanks, Flo!), we can reduce the amount of code you have to write even more.
If youâre interested in a blog or video series that walks you through the building this app, let me know!
Swift
I had the pleasure of meeting Josh Holtz at SwiftLeeds the other week. Josh is not only a super nice guy, he is also the lead maintainer of fastlane, and he knows a thing or two about code signing. If you ship apps to the App Store, sooner or later youâll have to understand how code signing works. Watch Joshâs i360 talk âDemystifying Code Signingâ, and get a head start!
đš My @360iDev talk on âDemystifying Code Signingâ is live đ±
â Josh âđ confâ Holtz đȘđ (@joshdholtz) October 14, 2021
đ https://t.co/DwUD9s65q9
I hope you all enjoy my madness đ pic.twitter.com/xE9TEU3msH
In one of my apps, I need to parse some JSON data that the YouTube API returns. Instead of hand-writing all the structs I needed for holding the results myself, I used QuickType. This is an amazing tool that can generate data classes and parsers for JSON for Swift, Java, TypeScript, Kotlin, C#, and a bunch of other languages. Just paste the a sample JSON into the web app, configure some options, and get ready-to-compile code. The Swift code generator makes use of Codable, so the resulting code is concise and easy to understand. Fantastic, and hard to believe this is a free tool!
SwiftUI
I mentioned a couple of environment-related posts in previous issues of this newsletter, and this week the trend continues!
Federico Zanetello of the Five Stars blog continues his series about the SwiftUI environment, and takes us onto a journey into EnvironmentValues and how it works.Â
If youâve been a subscriber of this newsletter for any amount of time, you know that Iâve mentioned how important the environment is for SwiftUI quite a few times now - it literally is the reason why you can configure SwiftUI views using view modifiers in the first place. So it is quite interesting to see which environmental values exist. Of course, you could go into the generated SwiftUI interface definition, but thatâs pretty tedious. Frederico shows us a better, more elegant solution in his blog post.
Iâve demonstrated how to use the SwiftUI environment in YouTube series Building SwiftUI Components, in which I show you how to build a reusable, configurable text input field with a floating label. Just yesterday, Stewart Lynch took my code and added some new features. Seeing how my work inspires other people to create new things always makes me smile. Check out Stewartâs implementation, and if youâre interested in learning more, watch my video series.
@peterfriese has an excellent series on YouTube on building SwiftUI components where he creates a floating label for TextViews. I have extended this to provide for secure fields, different size categories and added a rounded rectangle type border style.https://t.co/vxnq0bWSi0 pic.twitter.com/iyAYatn6pX
â StewartLynch (@StewartLynch) October 20, 2021
This week, Iâve been working on a widget for one of my apps, and one of the first challenges I faced was how to make sure the views in my widget take up the entire height and width of the widget. Here is a useful article by Sarun that explains how this works.
Firebase đ„
Firebase Summit will take place on November 10th (have you signed up yet?), and weâre busy preparing some exciting sessions and demos for you. To help pass the time until the event, weâve created three brand new pathways that highlight some of our products in a holistic way.
The first pathway focusses on App Check, a new Firebase feature that helps you to protect your backend resources from being accessed by malicious actors.
While all of the pathways cover existing Firebase products, they do hint at features we will be launching at Firebase Summit, so I recommend keeping an eye the event page and our Twitter feed to be the first to get notified when the next pathway launches.
Presentation Tools
Last week I linked to some articles that focussed on creating content for presentations, and this week Iâve got even more tools for you. I am a big fan of Appleâs Keynote app. You might think âbut itâs just a simple slideshow presentation appâ, and while you can use it to create simple, yet good-looking slide decks, it is much more powerful. In this thread, Justin Searls explains in detail how he created an animation that looks like the log output of a command line utility. All of it done using Keynote and its built-in animations.
Here's another Keynote demo. My goal was to display a terminal command in the center of the slide in large type, then print its full output without interrupting the visual continuity (i.e. without forcing your eyes to make the jump to the top of the slide). pic.twitter.com/4FwDnxmqFC
â Justin Searls (@searls) October 19, 2021
Of course, no presentation would be complete without a diagram, and what better way to show off your inner nerd than using ASCII art diagrams. A few weeks ago I linked to a web-based tool (not surprisingly built by a Google), but for the macOS aficionados among us here is a native app that lets you draw sweet ASCII charts from the comfort of your Mac.
If youâre too lazy to draw diagrams by hand, why not let the computer do the work for you? Ole Begemann shows you how to create a dependency graph for your SwiftPM packages:
Today I learned that SwiftPM can produce a package dependency graph you can feed into graphviz for visualization. Example for AsyncHTTPClient:
â Ole Begemann (@olebegemann) October 18, 2021
$ brew install graphviz
$ swift package show-dependencies --format dot | dot -Tsvg -o graph.svg pic.twitter.com/3FVAXEtf8i
Podcasts
Early in the pandemic, I picked up two habits: doing a fake commute (essentially walk around my neighbourhood, pretending to go to work), and listening to podcasts while I fake-commute (or do the chores). Iâve listened to more than 1500 episodes of various podcasts in these past 18 months, and over the next couple of newsletter issues, I will share some of the shows and episodes I loved.
Land of the Giants by Vox Media is a fantastic series that looks at some of the Big Tech companies and explores their history. Previous seasons covered Amazon, Google, Netflix, and the delivery service economy. The current season, The Apple Revolution, focusses on Apple and how it went from niche personal computer company to the most valuable company in the world, changing the way we consume music and other media along the way.