Repository navigation
Conversation
Add the task modifiers behind View.task(name:executorPreference:priority:_:) and its id: variant. Unlike _TaskModifier they also carry a task name and a TaskExecutor preference, and the action is @isolated(any). They start the task when the view appears, cancel it when it disappears and, for the value variant, cancel and restart it when the id changes. The inits are nonisolated: inherited from ViewModifier's @preconcurrency @mainactor isolation they would mangle the action parameter without YA (@isolated(any)), so the symbols SwiftUI-linked apps import would not be defined. The `n` in the mangled name comes from the sending action parameter. Tests pin the init shape and the mangled names, and the compatibility tests cover starting on appear and cancel and restart on an id change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
_TaskModifier2and_TaskValueModifier2<Value>, the modifiers behind thetask(name:executorPreference:priority:_:)family: like_TaskModifier/_TaskValueModifierplus a task name, aTaskExecutorpreference and an@isolated(any)action. The task starts when the view appears, is cancelled when it disappears, and (value variant) is cancelled and restarted when the id changes. No publicView.task(name:...)overload is added here; only the modifier types, which are underscored.Why
Apps linked against SwiftUI import the init symbols of these two types, and OpenSwiftUI had none. The init labels, parameter types and mangled names follow the symbol names observed as imports (names only; no code, interface files or binaries were read). One detail matters for the ABI: the inits must be
nonisolated. InheritingViewModifier's@preconcurrency @MainActorisolation makes swiftc 6.3.3 mangle the action parameter withoutYA(@isolated(any)), so the imported symbol would not be defined._TaskValueModifier2.valueis thereforenonisolated(unsafe)likeaction.Provenance
Local commits
c1164316(feat),f51f218f,83bfdd48,86da0aed,1bfe82edandb7c3e9de(2026-10-09 and 2026-10-10, Cristian Magherusan-Stanciu), squashed into the final state. A maintainer may want to look at the provenance wording above; I did not use anything but names. Dropped:Scripts/check-taskmodifier2-symbols.sh(a manualllvm-nmcheck on a built Mach-O, not run in CI; the test comment now says "check withnm"). Kept: the source,Tests/OpenSwiftUITests/Modifier/TaskModifier2Tests.swift(parameter storage,ViewModifierconformance, the mangled names as comments) andTests/OpenSwiftUICompatibilityTests/Modifier/ViewModifier/TaskModifier2LifecycleTests.swift(start on appear, cancel and restart on id change). 400 lines in total, all additions.Testing
Not compiled and tests not run: no Swift toolchain is available on the machine where I prepared this port. For the original commits the author reported standalone probes with swiftc 6.3.3 (arm64-apple-macosx26.0,
-swift-version 5,-enable-library-evolution) confirming that the two init names match exactly when the inits arenonisolatedand dropYAotherwise; those probes were not part of this repo's build. Needs a fullswift testrun (OpenSwiftUITestsandOpenSwiftUICompatibilityTests) before it is marked ready. The compatibility tests need a host that can show a window.🤖 Generated with Claude Code