With the release of Swift 6 and its data race checker, I've had to refactor big chunks of an application I'm working on. As part of this work, I've carved the core network code out into a Swift package. I'm releasing it under BSD 3-clause.
It has a few clever bits. Most notably, Certificate Truster.swift has all the code needed to connect to a domain and mark its certificate as trusted for that domain. Took a lot of work to figure that out. Basically every guide to dealing with TLS in URLSession simply disables certificate validation.