~/devreads

K. Harrison

https://useyourloaf.com/ · 5 posts · history since 2025 · active

24 Nov 2025

2 min read

How do you automatically format your Swift code every time you commit it to your Git repository? Swift Format There are several Swift formatting tools. Xcode 16 shipped with swift-format included in the toolchain: $ xcrun --find swift-format /Applications/Xcode.app/Contents/Developer/Toolchains/ XcodeDefault.xctoolchain/usr/bin/swift-format To run the formatter: $ swift format MyFile.swift Note: This runs the swift-format bundled with the active Xcode development directory…

27 Oct 2025

4 min read

Create a custom URL scheme handler for SwiftUI WebViews. Custom URL schemes Apple introduced both WebView and WebPage SwiftUI views in iOS 26. These provide similar WebKit functionality to the UIKit WKWebView APIs. This includes being able to register custom URL schemes to load local resources. Suppose I have an App that loads quotations from the local App bundle. My…

13 Oct 2025

5 min read

There’s less variation this year with the base iPhone 17 and Pro models sharing a display. The Plus model is gone but we get a new iPhone Air. Here’s what you need to know about the iPhone 17 models. The New Models in a Nutshell There’s no iPhone 17 Plus model this year. Instead the iPhone 17 gets the same…

7 Sept 2025

2 min read

Swift 6.2 makes it easier to interpolate strings with optional values. What’s The Problem? In this SwiftUI view I need to create a text string from an optional integer value: struct CounterView: View { let count: Int? var body: some View { Text("The count is \(count)") } } The compiler warns about the optional value: String interpolation produces a debug…

1 Sept 2025

2 min read

In Swift 6.2, Swift Packages give us control over which compiler warnings to treat as errors. Finer-grained Controls for Compiler Warnings The Swift compiler has options to treat all warnings as errors or suppress all warnings: -warnings-as-errors -suppress-warnings In Xcode, you add those compiler flags to the build settings for a target. In the “Swift Compiler - Custom Flags” section…