UIPointerInteraction Exception

I'm adding pointer interactions to my app.

if #available(iOS 13.4, *) {
    let interaction = UIPointerInteraction(delegate: self)
    button.addInteraction(interaction)
}


@available(iOS 13.4, *)
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
    UIPointerStyle(effect: .lift(UITargetedPreview(view: button)), shape: .roundedRect(button.frame, radius: ViewAssistant.buttonCornerRadius))
}

I get this exception sometimes, not sure why?
Thread 1: Exception: "UIPreviewTarget requires that the container view is in a window, but it is not. (container: <UIView: 0x10873d800> => <UIScrollView: 0x108873c00> => <_UIVisualEffectContentView: 0x108745070> => <Pixel_Nodes.PanelCreatorView: 0x108727ad0>)"

I have the same problem
UIPointerInteraction Exception
 
 
Q