👀 Generate preview images for blog articles with SwiftUI and GitHub Actions 🖼
Welcome to the 15th issue of the iOS Coffee Break Newsletter 📬.
Sharing links to your blog on social media looks much better with well-designed previews (e.g., on Twitter). These previews can be set up in various ways, often involving custom images for each post.
I wasn't happy with how my newsletter posts were displayed on Twitter. They appeared plain, lacking any image preview — just a dull, grey square. Honestly, it didn't look appealing at all. Pretty disappointing, right 😑?
Some websites generate preview images either by using a predefined template or by creating them programmatically. Here is an example by Antoine where a preview is either based on a set template or dynamically generated through code. This is what I wanted to achieve!
I realized I needed to get my hands dirty, so I created an automated system using SwiftUI and GitHub Actions to generate custom preview images for my weekly issues 🖼. This setup not only saves time but also guarantees that each post has a unique, polished look when shared on social media.
So if you are looking to add a personal touch to your blog articles, I recommend checking out the article I wrote on this topic. It walks you through the entire process step by step!
Now it's time to dive into some iOS development topics submitted by the community. Here are this week's highlighted resources. Hope you enjoy 🙌.
🏆 Day to Day Starting 11: The ToolSet Team to win championships
Manu has returned to writing and recently published one of the most unique articles I have come across in a while. If you are into football, you will definitely enjoy it. Manu creatively picks his own starting 11, featuring productivity tools that have made a significant impact on his workflow, efficiency, and daily life.
👴 Using Characterization Tests When Working With Legacy Code
Every software engineer encounters legacy code at some point. Being able to navigate various coding environments, particularly legacy ones, is crucial.
Vera shares insights from Michael C. Feathers' book Working Effectively with Legacy Code, emphasizing the importance of a concept called characterization tests. By using these tests, you ensure that the existing code behaves as expected, which improves its readability for others and maintains consistency in future updates.
P.S. Great job with the artistic touch, Vera!
🎨 Understanding Colors and Styles in Terminal Output
When working with command line tools, visual design often takes a back seat, and most tools appear uniform and lack styling. However, that doesn't have to be the case!
In this post, Natan breaks down how you can enhance the appearance of your Swift executables by using ANSI Escape Codes. He provides a comprehensive guide on how to apply these codes to strings, allowing you to introduce styles like colors and formatting, giving your CLI tools a more polished and personalized look.
🚚 How to pass Bindings to views in SwiftUI's NavigationDestination modifier
In SwiftUI, it is typical to display a list where users can navigate to a detailed view after selecting an item.
However, it may not be immediately obvious how to use bindings when working with NavigationLinks
and the .navigationDestination
modifier.
In this article, Pol outlines two straightforward methods that make passing a binding to the detail view seamless, offering a clear solution to this common challenge.
⌛ Swift Build Times and Module Verification...
Paulo shared an useful tip for those building Swift frameworks to significantly reduce build times.
By setting ENABLE_MODULE_VERIFIER
to FALSE
, his clean build times dropped from 3.5 minutes to just 52 seconds 😱.
If you are working with Swift frameworks and using Xcode 16 betas, it is highly recommended to apply this build setting change for debug builds and build with timing summaries periodically for optimization insights.