How are SwiftUI Shapes supposed to work with Swift 6?
Shape conforms to View which uses @MainActor but the path function and animatableData are both nonisolated. How can they access animatable properties that have to be a var on the main actor?
Below is a simple Shape that will show these warnings:
struct SimpleShape: Shape {
var width: Double
var animatableData: Double {
get { width }
set { width = newValue }
}
func path(in rect: CGRect) -> Path {
var path = Path()
let width = self.width
path.addRect(.init(origin: rect.origin, size: .init(width: width, height: rect.height)))
return path
}
}
@RyanLintott Thanks for flagging that. Could you please file a bug report and post the FB number here once you do. Please be sure to test on future beta releases as well.