Well, I have been looking around google and couldn't manage to find a good way to create an OnTwoFingerTap detection, if anyone could help me out please:) I would be greatful
So in this link there was a solution, which had errors: Error build: Reference to generic type 'UIViewRepresentableContext' requires
func makeUIView(context: UIViewRepresentableContext) -> UIView
{
let view = UIView()
let doubleTapGestureRecognizer = UITapGestureRecognizer(target: context.coordinator, action: #selector(Coordinator.handleTap(sender:)))
/// Set number of touches.
doubleTapGestureRecognizer.numberOfTouchesRequired = 2
view.addGestureRecognizer(doubleTapGestureRecognizer)
return view
}
func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext)
{
}
I fixed it by switchhing UIViewRepresentContext to Context
func makeUIView(context: Context) -> UIView
{
let view = UIView()
let doubleTapGestureRecognizer = UITapGestureRecognizer(target: context.coordinator, action: #selector(Coordinator.handleTap(sender:)))
/// Set number of touches.
doubleTapGestureRecognizer.numberOfTouchesRequired = 2
view.addGestureRecognizer(doubleTapGestureRecognizer)
return view
}
func updateUIView(_ uiView: UIView, context: Context)
{
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.