Repository navigation
Conversation
Qualify the rotor's captured `elements` access and snapshot the text size variant before the escaping Foundation callback. This removes the implicit- self and mutating-self diagnostics when the Foundation callback is escaping. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for putting this together. Both Apple's Foundation ( Working around missing SDK header annotations at individual call sites in OpenSwiftUI doesn't address the underlying header mismatch (any new |
Summary
Two escaping callbacks capture state implicitly. This makes both captures explicit:
AccessibilityLinkRotorBridge.update()writesself.elementsinside theenumerateAttributecallback.DynamicTextHelper.widthAdaptedTextreads thesizeVariantproperty inside theenumerateAttributecallback; it now reads it once into a local before the callback.Why
With a Foundation whose
enumerateAttribute/enumerateAttributescallback is@escaping(the Foundation used by our Darling work, not Apple's), the unchanged code produces the implicit-self diagnostic in the rotor and the mutating-self capture diagnostic in the lazy var of a struct. Apple's Foundation declares the callback non-escaping, so behaviour there is unchanged. The change has no effect on behaviour: the same values are used, they are just named or read earlier.Provenance
Local commit from 2026-10-15 (Cristian Magherusan-Stanciu), originally two commits on 2026-10-13 combined into one. It applies to current
mainwithout changes; I reworded the message.Testing
Not compiled with this repo's package build, and no tests run: no Swift toolchain is available on the machine where I prepared this port. The original author reported, for the original commit, reduced-source red/green checks with Swift 6.3.3 (the unchanged expressions reproduce the diagnostics, the changed ones emit SIL without them). The complete OpenSwiftUI package, link and runtime were not verified then either. No test was added: the change has no runtime-visible effect on Apple platforms.
🤖 Generated with Claude Code