Working with Local Swift Packages

Imagine you’re working on Project A, which relies on Package B, a remote Swift package. To incorporate modifications in B and assess their impact on A, the standard approach requires committing and pushing the changes in B, updating B’s version in A, and then rebuilding A to observe the outcomes. This method is slow and cumbersome. There must be a better way! Project A | └──> Swift Package B To speed up and improve the workflow, you can convert the remote dependency B to a local one....

February 27, 2024 · Bartosz Kunat

Creating Tag-Specific RSS Feeds in Hugo with PaperMod

This website uses the PaperMod theme for Hugo. The default setup offers a primary RSS feed for all posts at yoursite.com/index.xml. However, I needed more granularity—specifically, RSS feeds for posts tagged with certain keywords. After some exploration and experimentation, I discovered that Hugo automatically generates RSS feeds for each tag. TIL! Here’s how you can access these tag-specific RSS feeds: iOS Tag Feed: https://kunat.dev/tags/ios/index.xml Swift Tag Feed: https://kunat.dev/tags/swift/index.xml Utils Tag Feed: https://kunat....

January 30, 2024 · Bartosz Kunat

Alfred Snippet Converter

A few months ago, I wrote about Alfred Snippets on iOS. In that article, I described the manual process of converting Alfred text snippets into macOS text replacements. Since then, I’ve had time to refine this project and add some new features. You can download the final Command Line Interface (CLI) or the macOS app from this link. Next on my list is the complete automation of the process of synchronizing Alfred text snippets with macOS text replacements....

December 27, 2023 · Bartosz Kunat

Automating Adding SPM Plugins

How to automate adding plugins to all of your existing (and future) targets in a Swift package TL;DR package.targets = package.targets.map { target in var plugins = target.plugins ?? [] plugins.append(.plugin(name: "SwiftLintPlugin", package: "SwiftLint")) target.plugins = plugins return target } The Problem Last month, I was tasked with adding SwiftFormat and SwiftLint to one of the projects my team maintains. The project is medium-sized and uses Swift Package Manager (SPM) for modularization....

December 18, 2023 · Bartosz Kunat

Integrating a Spm Package With Higher Deployment Target

tl;dr this is currently not possible. See Solution. Last week, I was working on extracting functionality responsible for handling Live Activities into a separate Swift Package Manager (SPM) package. Apple introduced Live Activities with the release of iOS 16.1. My project’s deployment target is currently set to iOS 13. As you can imagine, this feature had lots of #if available checks. To make my life a bit easier, I’ve decided to set my package’s deployment target to iOS 16....

October 30, 2023 · Bartosz Kunat

NextDNS: Breaking Bad Habits

My story begins with a quest for a reliable ad blocker for Safari. I used Wipr for years, but it started performing poorly. I tried AdGuard, but it required a root certificate for HTTPS traffic, which was a dealbreaker. PiHole seemed complex to configure, so I found NextDNS, a DNS-level content blocker promising effective ad and tracker filtering. I decided to try it. NextDNS: The Game Changer NextDNS turned out to be a game-changer for several reasons....

September 30, 2023 · Bartosz Kunat

My Alfred Setup

Last updated: 13/08/23 I’ve relied on Alfred as my daily driver for boosting productivity for years. However, I didn’t switch from Apple’s Spotlight overnight. It took three attempts before I truly embraced its capabilities. In this article I’ll share my Alfred setup and explain my most frequent workflows. Let’s dive in! The Initial Setup I’ve already described the initial setup in detail in New Mac Setup article, so be sure to check it if you’re interested....

August 13, 2023 · Bartosz Kunat

GitLab Code Coverage for Pure Swift Packages

How to use GitLab’s built-in test coverage report tool for pure Swift packages? Some test coverage report generation tools do not support “pure” Swift packages. One example is Slather. By pure, I’m referring to packages that contain only the Package.swift file, without any .xcodeproj or .xcworkspace files. One solution to this problem was to generate a project file for a Swift package on the fly using Fastlane. This solution has one limitation: it’s not possible to generate a project file for a Swift package that contains any resources....

July 28, 2023 · Bartosz Kunat

Building Long Term Investment Portfolio in Europe

I’ve been putting off this project for the past ~18 months. Most resources I’ve found focus primarily on US-based investors. Sadly, most of the assets listed in those resources are unavailable to investors located in other parts of the world. What came to my rescue was the Banker on Wheels blog. I did not find any other resource that came even close to this one. It was a one-stop shop for my use case....

June 21, 2023 · Bartosz Kunat

New Mac Setup

This note describes the steps I take when setting up a new Mac. This process could be mostly automated, but I can’t get myself to do it. It takes me around 90 minutes to go through all the steps. Let’s get started! Files to Import .gitconfig .zshrc Apps to Install Apps marked with “🌕” emoji are optional (it depends if it’s a work or a personal Mac). App Store Pause Clean Links Dynamo Meeter Preferences -> General -> Open at login Disable non-work related calendars Disable “Show countdown to next meeting” in Preferences -> Advanced Bear Notes Set themes Update Preferences -> Editor Set keyboard shortcuts Magnet Pixelmator Pro Balance Lock SourceryPro Vimari 🌕 Amphetamine 🌕 Color slurp 🌕 Boop 🌕 Wipr Web HomeBrew Alfred Disable both shortcuts for Spotlight Import preferences from /Users/$USER/Library/Application Support/Alfred/Alfred....

May 15, 2023 · Bartosz Kunat

Xcode Development Assets with XcodeGen

Development Assets in Xcode that allow developers to provide test data to use within SwiftUI previews and other code during development. Assets marked for development will only be included in debug builds and removed once you create an archive of your app. This solution is preferred to having larger assets in the production binary size. Developers can add different types of data as Development Assets, such as JSON files for mocked network requests, images to use in SwiftUI previews, Core Data sample databases, and Swift files representing mocked or sample data....

April 10, 2023 · Bartosz Kunat

Connectivity Issues with Logitech MX Keys on macOS Ventura

After installing macOS Ventura, I began experiencing connectivity issues when using MX Keys keyboard through Bluetooth. The keyboard would disconnect from my Mac whenever it was inactive for a few minutes. What made this issue especially frustrating was that it didn’t happen every time, and the time it took for the keyboard to reconnect varied widely. It drove me insane. I’ve been following several threads in r/logitech, reaching out to Logitech support multiple times, and submitting bug reports through the Logi Options+ app....

April 4, 2023 · Bartosz Kunat

How to Tackle Duplicate Test Doubles Problem in Modular Architecture

After SPM asset support has been added to Xcode 12, there is no reason not to use modularization in your iOS projects. It brings value no matter the project and team size. However, after some time, you might encounter problems like increased complexity, difficulty with integration testing, or code duplication. Today we’ll focus on the last one, specifically, testing doubles duplication. Let’s jump in! Introduction When saying “module” I’m always referring to a group of related targets....

March 30, 2023 · Bartosz Kunat

Kill It With Fire Review

“Kill It with Fire” exceeded my expectations. I initially anticipated a boots-on-the-ground review of technical debt handling. What I’ve got instead was almost everything but that. The book has changed the way I think about technical debt and how to communicate it upwards. It provides sound advice on various topics, including how to fight tech debt, schedule maintenance work, and communicate with stakeholders. I have not come across any other book that provides this much credible advice on the topic of technical debt without exclusively catering to a particular audience....

March 17, 2023 · Bartosz Kunat

How to Connect Internal Dependencies in Swift Package Manager

Swift Package Manager (SPM) is a powerful tool for modularizing your code and managing dependencies in your projects. If you’re working on a project that uses SPM for modularization, you may need to add internal dependencies to connect different parts of your codebase. In this article, we’ll go over how to add internal dependencies in SPM and configure your Package.swift file to properly connect them. Assumptions Before we get started, let’s make a few assumptions about your project and its structure:...

March 16, 2023 · Bartosz Kunat

Recover Corrupted Apfs Drive

How to Recover a Corrupted APFS Encrypted Drive As a Mac user, I have always felt secure knowing that my data is protected with APFS encryption. However, that sense of security was shattered when I was unable to mount a disk and Disk Utility reported it as corrupted. I couldn’t use Disk Utility’s First Aid as it failed to repair the disk. Here is the story of how I recovered a corrupted encrypted APFS drive....

March 2, 2023 · Bartosz Kunat

My Productivity Setup

Today, I wanted to give you a high-level look at what tools I use to organize my work and life and how I use them. The setup I’m about to show you is a product of 5 years of refinement. I still tweak some things, so there’s a high chance it will evolve further in the coming months. Before we start, I wanted to mention that I’m deep into the Apple ecosystem....

February 18, 2023 · Bartosz Kunat

Handling Edit Menus Without the First Responder

Context I’m currently developing a chat-based app that requires the implementation of coping messages. Essentially, when a user long-presses a message bubble, an edit menu will appear with the option to “Copy.” This feature is a common element across most chat applications. For the purpose of this article, let’s assume that all message bubbles are constructed using a subclass of UITextView called MessageTextView. To make the “Copy” option appear on a long-press gesture, we’ll first need to add the appropriate gesture recognizer:...

January 31, 2023 · Bartosz Kunat

Alfred Snippets on iOS

Alfred allows you to save your frequently used text clips as Snippets. Over the past few years I’ve created hundreds of them. There’s one problem. Alfred snippets only work on your Mac. Today we’ll focus on how we can convert them into macOS snippets. That way, you’ll be able to use them across all your Apple devices! How Alfred stores snippets as a Zip archive. On macOS, you can open it with the Archive Utility app that’s shipped with the system....

January 25, 2023 · Bartosz Kunat