-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
I think this happened with SE-0463.
This method signature:
UIKIT_EXTERN API_AVAILABLE(ios(10.0)) API_UNAVAILABLE(watchos) NS_SWIFT_UI_ACTOR
@interface UIViewPropertyAnimator : NSObject <UIViewImplicitlyAnimating, NSCopying>
// ...
- (void)addCompletion:(void (^)(UIViewAnimatingPosition finalPosition))completion;
//...
@endUsed to import as this, which implies @MainActor
func addCompletion(_ completion: @escaping (UIViewAnimatingPosition) -> Void)And now imports as:
func addCompletion(_ completion: @Sendable @escaping (UIViewAnimatingPosition) -> Void)Which no longer implies @mainactor. I think this was intended, but it's suboptimal because we have to now wrap all the closures with MainActor.assumeIsolated { ... } after updating to Xcode 26.0
Reproduction
import UIKit
@MainActor final class MyClass {
var property: Int = 0
func scheduleAnimation(_ animator: UIViewPropertyAnimator) {
animator.addCompletion { _ in
self.property = 10
}
}
}Expected behavior
I would expect the @MainActor-ness of the class to inform the isolation of the @Sendable completion handler.
Environment
swift-driver version: 1.127.4.2 Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
Additional information
No response
nesium
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels