🐞has non-Sendable type
⟩
import SwiftUI
// ⭐️ Shape is Sendable
struct MyAnyShape: Shape {
// ⭐️ properties must be Sendable too.
private let shape: (CGRect) -> Path // 🐞 error
init<S: Shape>(_ wrapped: S) {
self.shape = { rect in
wrapped.path(in: rect)
}
}
func path(in rect: CGRect) -> Path {
shape(rect)
}
}錯誤原因
解決方案
Last updated