I have a SwiftUI view that uses a PKCanvasView However, I am receiving an error in the logs
2023-05-07 01:06:14.413211-0700 [24247:15704822] Metal API Validation Enabled
2023-05-07 01:06:16.157795-0700 [24247:15705030] [] Failed to allocate an IOSurface, falling back to a regular framebuffer to avoid crashing.
2023-05-07 01:06:18.096437-0700 [24247:15704904] [] Failed to allocate an IOSurface, falling back to a regular framebuffer to avoid crashing.
here's my CanvasView
struct DrawingCanvasView: UIViewRepresentable {
@Binding var canvas: PKCanvasView
let drawingPolicy: PKCanvasViewDrawingPolicy
func makeUIView(context: Context) -> PKCanvasView {
canvas.drawingPolicy = drawingPolicy
return canvas
}
func updateUIView(_ uiView: PKCanvasView, context: Context) {
}
}
and here's the view
struct ExpereinceDrawingContentView: View {
@ObservedObject private var viewModel: ExperienceDrawingContentViewModel
init(viewModel: ExperienceDrawingContentViewModel) {
self.viewModel = viewModel
}
var body: some View {
DrawingCanvasView(canvas: $viewModel.canvas, drawingPolicy: .anyInput)
.onAppear(perform: viewModel.handleViewDidLoad)
.navigationTitle("Draw")
.toolbar {
Button("Done") {
viewModel.handleDone()
}
}
}
}
here's what's happening in the UI