Here is a hack which seems to work for me:
struct NoHitTesting: ViewModifier {
func body(content: Content) -> some View {
SwiftUIWrapper { content }.allowsHitTesting(false)
}
}
extension View {
func userInteractionDisabled() -> some View {
self.modifier(NoHitTesting())
}
}
struct SwiftUIWrapper<T: View>: UIViewControllerRepresentable {
let content: () -> T
func makeUIViewController(context: Context) -> UIHostingController<T> {
UIHostingController(rootView: content())
}
func updateUIViewController(_ uiViewController: UIHostingController<T>, context: Context) {}
}
Which you can use like this to disable the background view for instance when it covers up a UIViewController, etc.
Color.red.userInteractionDisabled()
Post
Replies
Boosts
Views
Activity
Please any solutions here? It seems that each PKCanvasView created allocates somewhere between 1-5 mb of space, so if you create 30 on a page (which, seems reasonable to me as someone who is providing a calendar view with a difference view per cell) the device runs out of memory... even though the memory isn't being used?