Paul Hudson

@twostraws.bsky.social

I write Swift and write about Swift, but most people prefer my dogs.

accessibilityInputLabels() lets Voice Control users activate UI controls with custom spoken commands. Without it, they'd have to recite the entire text of a view just to tap a button - imagine doing that when a stock price changes every second. www.hackingwithswift.com/articles/261...

I screwed up one key accessibility behavior, and now I'm on a mission to do better

Accessibility labels, hints, and grouping are great, but don’t forget to think about Voice Control too.

hackingwithswift.com

For HWS+ subscribers: StaticString is a string type that can only be created at compile time, which means no string interpolation and no surprises. It's perfect for cleaning up failable initializers when you know the value is always correct. www.hackingwithswift.com/plus/inside-...

StaticString – Hacking with Swift+

Sometimes less is more, and Swift's StaticString is a great example of how adding restrictions actually adds usefulness.

hackingwithswift.com

Dictionaries with non-String, non-Int keys couldn't encode cleanly into keyed containers. The new CodingKeyRepresentable protocol bridges that gap, letting custom key types participate in Codable properly. www.hackingwithswift.com/swift/5.6/co...

Allow coding of non String/Int keyed Dictionary into a KeyedContainer – available from Swift 5.6

Allow coding of non String/Int keyed Dictionary into a KeyedContainer example code from Swift 5.6

hackingwithswift.com

For HWS+ subscribers: Swift Argument Parser makes it easy to build useful macOS command-line tools, and a JSON tidier is a great first project. This one can prettify, compress, sort keys, and write output to a file, all in surprisingly little code. www.hackingwithswift.com/plus/command...

JSON Tidy – Hacking with Swift+

JSON is one of the most common file formats we deal with, so we can write a little macOS utility to make it nicer to work with – compressing the data, formatting the data, and even sorting the key nam...

hackingwithswift.com

I'm pleased to announce v2.0 of my SwiftUI Pro agent skill! It's packed with improvements based on real-world testing of iOS 27 and iPhone Duo, and also integrates a variety of advice from Apple's own skills. Get it here: github.com/twostraws/sw...

GitHub - twostraws/SwiftUI-Agent-Skill: SwiftUI agent skill for Claude Code, Codex, and other AI tools.

SwiftUI agent skill for Claude Code, Codex, and other AI tools. - twostraws/SwiftUI-Agent-Skill

github.com

There's an open-source SwiftUI agent skill that catches the mistakes AI tools keep making: deprecated modifiers, accessibility gaps, performance pitfalls. One command to install, and your AI-generated SwiftUI gets a serious quality boost. www.hackingwithswift.com/articles/282...

SwiftUI Agent Skill - Write better code with Claude, Codex, and other AI tools

Improve the AI-written code in all your SwiftUI projects with my free agent skill

hackingwithswift.com