Firebase
Scribble Diffusion with Flutter and Firebase
My colleague Lahiru built an AI powered Flutter web app that uses Cloud Functions, Cloud Firestore, and Replicate to create AI art from scribbles.
Check out my creation, A Spaceship Has Landed Near Brandenburg Gate in Berlin. Try it for yourself and share your own creations by replying to Lahiru's thread!
And if you're interested in the source code - it's available in this repo, including a high-level discussion of the architecture.
Swift
SwiftUI 🤝 Localizable.stringsdict
If you've watched Natalia's talk Mysteries of SwiftUI Text View, you will know that SwiftUI's Text
view uses localizable strings. But what
if you need to resolve different strings for plurals / singulars?
François shows how this can be achieved using string dictionaries.
SwiftUI
StateObject | Apple Developer Documentation
State management is one of the key features that make SwiftUI both easy and hard to use, and there are a great many blog posts, videos, and tutorials out there that explain how SwiftUI's property wrappers work.
Over the years, Apple has done a great job explaining how SwiftUI works in their WWDC videos, but if you're more of a reader, then you will be pleased to hear that they've just updated the documentation for @StateObject
to explain how it really works.
One of they key takeaways is: view identity is key, and has a huge impact on whether or not SwiftUI reinitializes a state object.
This is a must read for anyone who uses SwiftUI. Thanks to Luca Bernardi for calling this out.
Passing Data in SwiftUI via the View’s Environment
To learn more about SwiftUI's state management and how to pass data from view to view, check out this series by Giovanni Monaco from the Create with Swift team.
It's a great complement to Apple's updated documentation for the @StateObject property wrapper.
Customizing Lists in SwiftU
This is a great visual summary of how to customise SwiftUI List
views. I love Craig's to-the-point style of explaining things, and this video does a great job to explain the key customisations that are available.
Asynchronous Programming with SwiftUI and Combine
If you would like to learn more about SwiftUI, its state management, Combine, and how to use async/await and Combine together, check out my new book Asynchronous Programming with SwiftUI and Combine.
Here are some of the chapters that are related to the links of this issue of the newsletter :
To buy the book directly from the publisher, use this affiliate link: Asynchronous Programming with SwiftUI and Combine
Writing
The visual reference guide for documenting your Swift code
Documenting is an important aspect of writing code, and thanks to DocC, it is easier than ever to create beautiful documentation from inline code comments and additional Markdown files.
Marco's guide for writing code documentation for Swift came in handy this week, as I was working on creating an interactive tutorial with DocC.
However, I noticed that some things work slightly differently for interactive tutorials. For example, callouts for tutorials have to start with >
, whereas you can use -
in source code docs.
This works fine for interactive tutorials:
> Warning: This will result in a compiler error.
This doesn't:
- Warning: This will result in a compiler error.
Business
inessential: On Not Taking Money for NetNewsWire
This article is an interesting read by Brent Simmons about why you might not want to take money for a product.
This obviously only works if you've got other stream of income, so it comes down to whether or not you can afford to do something as a hobby, out of goodwill, or as a side product of something else that makes enough money to pay for your living.
Apple doesn't want you developing hobby apps
On the note of building apps as a hobby, Dave Bennett wrote a piece that raises the question whether or not it is a good idea for Apple to decide over what's a useful app:
If your app is not particularly useful, unique, or “app-like,” it doesn’t belong on the App Store.
Paying Apple a certain amount for using their infrastructure to review and distribute your app is something that most developers seem to be OK with, but it seems like there is room for an Apple Developer Program membership that allows you to build your hobby apps without distributing them to the App Store.
Pagi on the App Store
This story starts out all too familiar: a developer's app is rejected on the grounds of some of the rules Apple laid out in their App Store Review Guidelines. Their frustration grows as they try to figure out the real reason, the feedback they get from the review team sounding more or less cookie-cutter evasive.
The story ends well, but it does leave you wondering communicating with more empathy wouldn't be a better way for companies to communicate with people who build on their platforms.
Design
Creating isometric icons
If you've always wondered how to create isometric icons, here is a tutorial how to do this in Sketch.
Podcasts
Sun's Mobile Blunders
This is a super interesting episode with Shai Almog about the early days of mobile phones, and what could have been if Sun had tried to unify the mobile market.
From today's perspective it is mind-blowing to think that an operating system provider would create customised versions of their OS for individual hardware vendors and their different devices. It's the complete opposite of the DRY principle.
Fun stuff
Who is your younger cousin's mother's sibling's daughter OR father's sister's daughter?
I think this ranks very highly on the list of most hilarious variable names (although, as Marin pointed out, this really isn't a variable, but rather a constant)
Comment
When should you build an app vs. a web site?
It seems like Apple has been in two minds about this ever since the iPhone launched. The initial version of iPhoneOS, as it was called back then, didn't allow developers to build native apps for the iPhone. The only option was building web apps for Safari. Now, while web apps are a great approach for many services, looking at the screenshots of the web app directory in this article makes me feel uneasy - many web apps are super brittle, and I've more than once lost the work of the past half hour or more just because a web app (or site) didn't persist state well, and had a terrible navigation.
Things have changed a lot since then, and the App Store has seen a tremendous success, thanks to native apps. You'd be forgiven for thinking that Apple has changed their opinion about apps, and wants all developers to build native apps for their platforms, but you might change your mind after reading Dave's story about hobby apps later in this episode.
I do think web apps are a great approach for many use cases, for example if you want to experiment with an idea and want to ship something to a large number of people without requiring them to download a binary to their devices. One of my colleagues has built an web app based on Flutter and Cloud Functions for Firebase that is a great example. By making it available on the web, it is much more accessible for anyone - no matter the operating system they use (and if they can even afford an expensive phone), and it was much easier for him to roll it out to a large number of people without having to implement it for both iOS and Android.
What are your thoughts about this? Let me know by replying to this email, or on Twitter!
Peter 🔥