Post

Replies

Boosts

Views

Activity

Xcode 16 Beta: Animatable + non isolated protocol requirement errors.
Here's some simple sample code which produces warnings (or errors if using Swift 6 language mode), annotated with the errors: struct MyEffect: GeometryEffect { var animatableData: CGFloat // ERROR: Main actor-isolated property 'animatableData' cannot be used to satisfy nonisolated protocol requirement func effectValue(size: CGSize) -> ProjectionTransform { // ERROR: Main actor-isolated instance method 'effectValue(size:)' cannot be used to satisfy nonisolated protocol requirement ProjectionTransform(.identity) } } I run into the same issue with Shape: private struct MyShape: Shape { var foo: UnitPoint = .zero var animatableData: CGPoint.AnimatableData = .zero // ERROR: Main actor-isolated property 'animatableData' cannot be used to satisfy nonisolated protocol requirement func path(in rect: CGRect) -> Path { print(foo) // ERROR: Main actor-isolated property 'foo' can not be referenced from a non-isolated context return Path() } } It seems that by conforming to these protocols (which share Animatable conformance), all properties within the struct become annotated with @MainActor. Is this a bug?
1
3
149
3w