Documentation
¶
Overview ¶
Command mainactorisolation harvests Swift @MainActor isolation facts for Objective-C frameworks and writes them into per-framework sidecar files (mainactor.json) next to the committed .gometa.json metadata.
Why a separate tool (and not the scanner): Apple expresses main-thread affinity as Swift's @MainActor. In the headers it is the macro NS_SWIFT_UI_ACTOR, which expands to __attribute__((swift_attr("@MainActor"))). Clang parses the attribute, but `clang -ast-dump=json` — the form the scanner consumes — omits the swift_attr argument string, so the isolation is invisible on that path. The Swift symbol graph carries it faithfully (as the s:ScM attribute fragment), so this tool drives `swift-symbolgraph-extract` and reads the isolation out of the resulting symbol graph.
The committed sidecars let `go run ./cmd/generate/ idiomatic` apply the isolation without a Swift toolchain, exactly as appledocs.json works.
Usage:
go run ./scripts/tools/mainactorisolation fetch --framework AppKit go run ./scripts/tools/mainactorisolation fetch --framework AppKit,WebKit go run ./scripts/tools/mainactorisolation fetch --framework all