Reminder: macOS system frameworks binaries are hidden (since Big Sur)

Every now and again I’ll go to do something really innocuous with an Apple framework, like disassemble it in Hopper or check the link headers. And every. single. time. I forget that Apple did some really weird shit in Big Sur, and removed the binaries. $ ls -lh /System/Library/Frameworks/AppKit.framework/Versions/Current/AppKit ls: /System/Library/Frameworks/AppKit.framework/Versions/Current/AppKit: No such file or… Read more

SwiftUI main thread hang detector

Illustration of the MacOS Spinning Pinwheel of Death cursor

This is just a little snippet that is quite useful for reporting when your GUI thread (the main thread / actor) hangs for a significant amount of time. There are numerous heavier-weight tools for analysing this sort of thing, but I’ve found that this simple monitor does what I need most of the time. You… Read more

Mac app sandboxing interferes with drag & drop

Failed to get a sandbox extension Right from there, you know you’re going to have a bad day. 😔 Then you try to actually use the file dropped on your app, and you get: Upload preparation for claim 1C0F9013-4DEB-4E5D-8896-F522AA979BA6 completed with error: Error Domain=NSCocoaErrorDomain Code=513 ““Example.jpg” couldn’t be copied because you don’t have permission to… Read more

Swift code syntax highlighting in WordPress

ContentsBaseline: XcodeCommon limitation: no Light/Dark mode supportThe contestantsCode Block ProPerformanceProsConsCodeColorerPerformanceCode Syntax BlockPerformanceProsConsEnlighterPerformanceProsConsHighlighting Code BlockPerformanceProsConsPrismaticSyntax-highlighting Code Block (with Server-side Rendering)PerformanceProsConsSyntaxHighlighter EvolvedPerformanceProsConsUrvanov Syntax HighlighterPerformanceProsConsThe winnerWhat are other websites using? The built-in “code” block for WordPress (the CMS I use for this site) is virtually useless – it’s just a <pre> block, essentially. The appearance may vary depending… Read more

SwiftData pitfalls

I’ve been exploring SwiftData lately, and I’ve been unpleasantly surprised by how many sharp edges it has. I’m going to try to describe some of them here, so that hopefully others can avoid them (or perhaps be dissuaded from using SwiftData to begin with). I’m using Xcode 15.0.1 (Swift 5.9) on macOS 14.1 (Sonoma). Background… Read more

Collection enumeration performance in Swift

Swift’s Collection and Sequence protocols provide two primary ways to enumerate (filter, map, reduce, etc): functional-style and imperatively. For example: Or: Nominally these are equivalent – they’ll produce the same results for all correctly-implemented Collections and Sequences. So in principle which you use is purely a matter of stylistic preference. But is it? Do they… Read more