| Flutter iOS Embedder |

Instance Methods | Properties | List of all members
FlutterTouchInterceptingView Class Reference

`#import <FlutterPlatformViews_Internal.h>`

Inheritance diagram for FlutterTouchInterceptingView:

## Instance Methods
(instancetype) | - initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:
(void) | - releaseGesture
(void) | - blockGesture
(UIView *) | - embeddedView
(id) | - accessibilityContainer

## Properties
id | flutterAccessibilityContainer

## Detailed Description

Definition at line 521 of file FlutterPlatformViews.mm.

## Method Documentation

## ◆ accessibilityContainer

- (id) accessibilityContainer |  |  |

Provided by category FlutterTouchInterceptingView(Tests).

## ◆ blockGesture

- (void) blockGesture |  |  |

Definition at line 584 of file FlutterPlatformViews.mm.

584 {
585 switch (_blockingPolicy) {
586 case FlutterPlatformViewGestureRecognizersBlockingPolicyEager:
587 // We block all other gesture recognizers immediately in this policy.
588 self.delayingRecognizer.state = UIGestureRecognizerStateEnded;
589
590 // On iOS 18.2, WKWebView's internal recognizer likely caches the old state of its blocking
591 // recognizers (i.e. delaying recognizer), resulting in non-tappable links. See
592 // https://github.com/flutter/flutter/issues/158961. Removing and adding back the delaying
593 // recognizer solves the problem, possibly because UIKit notifies all the recognizers related
594 // to (blocking or blocked by) this recognizer. It is not possible to inject this workaround
595 // from the web view plugin level. Right now we only observe this issue for
596 // FlutterPlatformViewGestureRecognizersBlockingPolicyEager, but we should try it if a similar
597 // issue arises for the other policy.
598 if (@available(iOS 18.2, *)) {
599 // This workaround is designed for WKWebView only. The 1P web view plugin provides a
600 // WKWebView itself as the platform view. However, some 3P plugins provide wrappers of
601 // WKWebView instead. So we perform DFS to search the view hierarchy (with a depth limit).
602 // Passing a limit of 0 means only searching for platform view itself; Pass 1 to include its
603 // children as well, and so on. We should be conservative and start with a small number. The
604 // AdMob banner has a WKWebView at depth 7.
605 if ([self containsWebView:self.embeddedView remainingSubviewDepth:1]) {
606 [self removeGestureRecognizer:self.delayingRecognizer];
607 [self addGestureRecognizer:self.delayingRecognizer];
608 }
609 }
610
611 break;
612 case FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded:
613 if (self.delayingRecognizer.touchedEndedWithoutBlocking) {
614 // If touchesEnded of the `DelayingGesureRecognizer` has been already invoked,
615 // we want to set the state of the `DelayingGesureRecognizer` to
616 // `UIGestureRecognizerStateEnded` as soon as possible.
617 self.delayingRecognizer.state = UIGestureRecognizerStateEnded;
618 } else {
619 // If touchesEnded of the `DelayingGesureRecognizer` has not been invoked,
620 // We will set a flag to notify the `DelayingGesureRecognizer` to set the state to
621 // `UIGestureRecognizerStateEnded` when touchesEnded is called.
622 self.delayingRecognizer.shouldEndInNextTouchesEnded = YES;
623 }
624 break;
625 default:
626 break;
627 }
628 }

References embeddedView, FlutterPlatformViewGestureRecognizersBlockingPolicyEager, and FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded.

## ◆ embeddedView

- (UIView*) embeddedView |  |  |

Referenced by blockGesture, and initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:.

## ◆ initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:

- (instancetype) initWithEmbeddedView: |  | (UIView*) | embeddedView
platformViewsController: |  | (FlutterPlatformViewsController*) | platformViewsController
gestureRecognizersBlockingPolicy: |  | (FlutterPlatformViewGestureRecognizersBlockingPolicy) | blockingPolicy

Definition at line 522 of file FlutterPlatformViews.mm.

522 :(UIView*)embeddedView
523 platformViewsController:(FlutterPlatformViewsController*)platformViewsController
524 gestureRecognizersBlockingPolicy:
525 (FlutterPlatformViewGestureRecognizersBlockingPolicy)blockingPolicy {
526 self = [super initWithFrame:embeddedView.frame];
527 if (self) {
528 self.multipleTouchEnabled = YES;
529 _embeddedView = embeddedView;
530 embeddedView.autoresizingMask =
531 (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
532
533 [self addSubview:embeddedView];
534
535 ForwardingGestureRecognizer* forwardingRecognizer =
536 [[ForwardingGestureRecognizer alloc] initWithTarget:self
537 platformViewsController:platformViewsController];
538
539 _delayingRecognizer =
540 [[FlutterDelayingGestureRecognizer alloc] initWithTarget:self
541 action:nil
542 forwardingRecognizer:forwardingRecognizer];
543 _blockingPolicy = blockingPolicy;
544
545 [self addGestureRecognizer:_delayingRecognizer];
546 [self addGestureRecognizer:forwardingRecognizer];
547 }
548 return self;
549 }

References embeddedView.

## ◆ releaseGesture

- (void) releaseGesture |  |  |

Definition at line 565 of file FlutterPlatformViews.mm.

565 {
566 self.delayingRecognizer.state = UIGestureRecognizerStateFailed;
567 }

## Property Documentation

## ◆ flutterAccessibilityContainer

- (id) flutterAccessibilityContainer
| read write nonatomic retain

Definition at line 151 of file FlutterPlatformViews_Internal.h.

The documentation for this class was generated from the following files:

- shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
- shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h

FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded
@ FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded
Definition: FlutterPlugin.h:269
ForwardingGestureRecognizer
Definition: FlutterPlatformViews.mm:700
FlutterDelayingGestureRecognizer
Definition: FlutterPlatformViews.mm:651
FlutterPlatformViewGestureRecognizersBlockingPolicyEager
@ FlutterPlatformViewGestureRecognizersBlockingPolicyEager
Definition: FlutterPlugin.h:261
FlutterPlatformViewGestureRecognizersBlockingPolicy
FlutterPlatformViewGestureRecognizersBlockingPolicy
Definition: FlutterPlugin.h:252
FlutterPlatformViewsController
Definition: FlutterPlatformViewsController.h:31
-[FlutterTouchInterceptingView embeddedView]
UIView * embeddedView()