| 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 513 of file FlutterPlatformViews.mm.

## Method Documentation

## ◆ accessibilityContainer

- (id) accessibilityContainer |  |  |

Provided by category FlutterTouchInterceptingView(Tests).

## ◆ blockGesture

- (void) blockGesture |  |  |

Definition at line 510 of file FlutterPlatformViews.mm.

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

## ◆ embeddedView

- (UIView*) embeddedView |  |  |

## ◆ initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:

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

Definition at line 510 of file FlutterPlatformViews.mm.

514 :(UIView*)embeddedView
515 platformViewsController:(FlutterPlatformViewsController*)platformViewsController
516 gestureRecognizersBlockingPolicy:
517 (FlutterPlatformViewGestureRecognizersBlockingPolicy)blockingPolicy {
518 self = [super initWithFrame:embeddedView.frame];
519 if (self) {
520 self.multipleTouchEnabled = YES;
521 _embeddedView = embeddedView;
522 embeddedView.autoresizingMask =
523 (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
524
525 [self addSubview:embeddedView];
526
527 ForwardingGestureRecognizer* forwardingRecognizer =
528 [[ForwardingGestureRecognizer alloc] initWithTarget:self
529 platformViewsController:platformViewsController];
530
531 _delayingRecognizer =
532 [[FlutterDelayingGestureRecognizer alloc] initWithTarget:self
533 action:nil
534 forwardingRecognizer:forwardingRecognizer];
535 _blockingPolicy = blockingPolicy;
536
537 [self addGestureRecognizer:_delayingRecognizer];
538 [self addGestureRecognizer:forwardingRecognizer];
539 }
540 return self;
541 }
FlutterPlatformViewGestureRecognizersBlockingPolicy
FlutterPlatformViewGestureRecognizersBlockingPolicy
Definition: FlutterPlugin.h:253
FlutterDelayingGestureRecognizer
Definition: FlutterPlatformViews.mm:647
ForwardingGestureRecognizer
Definition: FlutterPlatformViews.mm:696
FlutterPlatformViewsController
Definition: FlutterPlatformViewsController.h:31

## ◆ releaseGesture

- (void) releaseGesture |  |  |

Definition at line 510 of file FlutterPlatformViews.mm.

557 {
558 self.delayingRecognizer.state = UIGestureRecognizerStateFailed;
559 }

## Property Documentation

## ◆ flutterAccessibilityContainer

- (id) flutterAccessibilityContainer
| read write nonatomic retain

Definition at line 150 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