For me, I fixed this by dumping subclasses of UILongPressGestureRecognizer and UITapGestureRecognizer and using UIGestureRecognizerDelegate to get some touch event information instead.
Post
Replies
Boosts
Views
Activity
For my case the error and subsequent lockup/crash of WatchOS was caused by stacked use of NavigationStack i.e. The destination was rooted in a NavigationStack itself.
The fix was changing NavigationStack to NavigationView YMMV
e.g
struct CrashyView: View {
@Binding var buttons: [WatchButton]
@State var isRoot: Bool = true
var body: some View {
NavigationStack { // <--- change to `NavigationView` to avoid error
VStack {
List(buttons) { button in
NavigationLink {
CrashyView(buttons: .constant(button.children), isRoot: false) //<-- recursive stacking of `NavigationStack` is a problem
} label: {
ButtonView(button: button)
}
}
}
}
}
}
This content view imports via continuity camera in Xcode 15.0. You don't seem to need ImportFromDevicesCommands() in the window group
import SwiftUI
import SwiftData
import UniformTypeIdentifiers
struct ContentView: View {
@State var camImage: Image?
var body: some View {
Rectangle()
.fill(.green)
.overlay(
camImage
.frame(width: 400,height: 400)
.clipped()
)
.contextMenu(menuItems: {
Text("Menu Item 1")
Text("Menu Item 2")
Text("Menu Item 3")
})
.importsItemProviders([.image,.png,.jpeg,.rawImage], onImport: { providers in
for provider in providers {
let _ = provider.loadDataRepresentation(for: .jpeg) { data, error in
guard let data else { return }
guard let png = NSImage(data: data) else { return }
camImage = Image(nsImage: png)
}
}
return true
})
}
}