RSS Amplifier

Blog

Joseph Duffy

Blog posts written by Joseph Duffy

josephduffy.co.ukRSS feed ↗26 posts

Latest posts

Self-hosting macOS GitHub Runners

This post explains how to set up an Apple Silicon Mac as a self-hosted runner for use with GitHub Actions. I will focus on setting up Tartelet , but I will provide some alternatives at the end.

Smuggling Values Across Actors

I recently started updating an app to use the Swift 6 language mode and ran in to an issue using AVCaptureMetadataOutputObjectsDelegate . The issue is that the compiler cannot reason about which actor the delegate function is called on and it must be treated as nonisolated, however we know that it's being called on a specific actor (in this case the MainActor ), so how can we tell the compiler? In…

The Bug That Bit Me Twice

I've been working on a fix for a bug in Overamped, which causes the popover UI shown when tapping on an image in Google Images to be blank, if the link goes to an AMP page. This was a silly bug that never should've happened; knowing that Google can change their page structure at any time I should've been more cautious with my checks. As a temporary quick fix I removed all custom handling of Google…

Don't Use Scope Modifiers with Extensions

Extending types in Swift support setting the scope for the extension, i.e. public , internal , or private , with internal being implicit if nothing is specified. This may seem useful, but given the following snippet it's impossible to know what the scope of a function is: func doSomething() { // Do the thing }

Overamped 1.1.0 and the Year of Small

So far my Year of Small is going really well; as I write this I'm making some final changes and preparing to push out v1.1.0-RC.1, which I hope to submit the App Store in the next couple of days. Overamped 1.1.0 is an update I first started working on almost 3 months ago, and it should've been released earlier. My initial plan for 1.1.0 was to: Add a screen showing recently logged events Add an…

pastelghouls Available Again

pastelghouls is once again available for download on the App Store . It's a free sticker pack containing 6 ghoulish sticker. Originally released 19th October 2016, just in time for halloween, it was removed from the App Store December 7th 2019 due to not having an update for a substantial period of time. As part of my year of small I wanted to make this available again, and at the same time setup…

The Year of Small

I've become accustomed to using yearly themes – rather than New Years resolution – thanks to CGP Grey, who has a very good summary of yearly themes . It took me a while to home in on it but this year the title of my theme will be "Year of Small." I'll be focusing on all things small: Small people: spending time with and giving the best life to my now 9-month-old son. Small home improvements:…

Swift Package Collection Signing Using the Terminal

Swift Packages are JSON files that describe a collection of packages. This post will explain how to sign these packages with a trusted certificate entirely from the terminal. These methods should work on Linux and macOS alike. At the end I describe how to have Swift on Linux implicitly trust these packages. Using this technique I have published my own package collection . If you're targeting macOS…

Hosting DocC Archives

At WWDC21 Apple introduced DocC, a tool for creating archives of Swift documentation that includes the static files required to host a version of the documentation on a website. In this post I will summarise various methods of serving a DocC archive: Netlify Vapor middleware nginx Apache All the examples provided here are hosting the DocC archive for VaporDocC , the Vapor middleware I wrote for…

Handling iCal Files in iOS

The iCal format, first defined as a standard as RFC 2445 in 1998, is the universally accepted format for distributing calendar files, mainly used for distributing events. As part of my QR code scanning app Scanula I added support for detecting events in scanned objects. Thanks to the fantastic libical and the Swift wrapper swift-ical it's fairly easy to parse an iCal feed, but adding it to iOS is…

The iPod touch Is My Favourite Device for iOS Development

It's important to test across various screen sizes, which the iOS simulator is good for, but it's also important to test on real devices where possible. I currently have an iPhone 11 Pro, an iPhone 6, and 2 iPod touches. Out of all these I find the iPod touch to be the best device for a lot of iOS development.

My WWDC 2021 Wishlist

With WWDC 2021 just around the corner I've been thinking about what I'd like to see there. A lot of the popular discourse around this time of year is focussed on features of the operating systems but I want to look at what I'd like to see as a developer for Apple platforms. I love to develop for Apple platforms but it can often be a painful process. May is like a christmas for Apple developers.

Mapping Optional Binding to Bool

When displaying an alert in SwiftUI, if the value used to calculate whether the alert is presented is both Optional and does not conform to Identifiable 1 it is often recommended to use a separate flag, similar to: struct ContentView: View { @State private var alertText: String? @State private var isPresentingAlert = false var body: some View { Button("Show Alert") { self.alertText = "Alert Text"…

Supporting Multiple Swift Package Versions Without Breaking Compatibility

The Xcode 12 beta includes Swift 5.3 but drops support for iOS 8.x. This means that Swift packages that support iOS 8 will cause a warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. It's not possible to remove this warning within a project that depends on a Swift package with a deployment target of…

Running UI Tests on Mac Catalyst

While working on the 2.0 update for Gathered I have been trying to develop the app multiple platforms simultaneously. SwiftUI will solve this problem in the future, but I wish to support some OS versions that SwiftUI does not support. As part of this I have been creating UI tests to test performance, but ran in to an issue when running the UI tests on macOS using Mac Catalyst: Running tests... The…

My Swift Package Manager Release Workflow

I am currently maintaining numerous Swift Packages that don't receive a constant flow of updates, but do receive updates when new Swift updates come out, or as I think of useful additions. To ensure that I can make some of these less frequent updates without too much friction and with confidence in their correctness I rely heavily on GitHub Actions , which I'll go over in this blog post.

Capturing More Than `self`

A common pattern when using closures in Swift is to add [weak self] in the captures list to hold a weak reference to self and avoid a retain cycle. This is then often followed by the following: guard let self = self else { return } But I often forget that capture lists can capture other variables in the current scope, so I thought I'd highlight some other use cases.

HashableByKeyPath framework release 1.0.0

Today I have released the 1.0.0 version of a Swift package that aids with adding Equatable and Hashable conformance by using KeyPath s. The package is available on GitHub . I created the Swift Playground that sparked this concept in December 2018 , so this concept has been rattling around in my brain for a couple of years. The API has changed a lot since the original concept, but the core has…

Partial framework release 1.0.0

Today marks 1 year since I released a blog post demonstrating an implementation of Partial in Swift , and it also marks the release of the 1.0.0 version of a Swift package for Partial. The package is available on GitHub and supports SwiftPM, Carthage, and CocoaPods. This blog post will go over some of the changes that have been made since the original blog post, my rationale when making certain…

Partial in Swift

Partial is now available in its own Swift package on GitHub . This post is still valid, but somewhat out of date. Structs are incredibly useful in Swift, especially when representing static read-only data. However, the values of a struct often come from multiple sources, such as view controllers, network requests, and files on disk, which can make the creation of these structs cumbersome. There…

Gathered 1.3 Release Notes

Gathered 1.3 has been released and is now available on the App Store . Version 1.3 brings 2 new data sources, app-wide speed and UX improvements, and support for various features added in recent versions of iOS. This update also has lots of behind-the-scenes changes that will make future updates easier to create and deploy, which – along with my features roadmap – should mean more frequent…

iOS Share Sheets the Proper Way - Locations

Sharing a location on iOS is something that not a lot of apps need, but after requiring it for my latest app, Scanula , I found that there isn't a good resource explaining how to do it properly. This is the first post in a series of planned posts going over a few of the tips, tricks, and common pitfalls I have found while working with iOS Share Sheets.

Exploiting University Security for My Own Convenience

This blog post covers an open-source timetable parsing project I released a couple of months ago. It is available at https://timetable.josephduffy.co.uk and the source is available on GitHub . The post won't go too in-depth on the technical side of the project, but rather the story of how I discovered it was possible. Since starting my studies at the University of Huddersfield I've always wanted…

Gathered 1.0.1 and the Disable Device Sleep Setting

Gathered 1.0.1 was released a couple of weeks ago and I wanted to write a quick blog post addressing part of the changelog

It's a Duffy Thing

I recently released a major overhaul for this website. The old website used an old version Node.js and used Ghost to power the blog. I didn't find it very easy to maintain and wanted more flexibility. While the new website may not have the best design, I'm a lot happier with it overall. Along with the rewrite of the website itself, I also gave it a new name: It's a Duffy Thing. This was inspired…

Touch ID on the Lock Screen

Touch ID is a wonderful piece of technology, to the point where wouldn't buy an iOS device without it. It had many great uses, such as: Unlock the device Authorise Apple Pay payments Add biometric restrictions within apps However, I wish to discuss the first of these: unlocking the device.