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

## Method Documentation

## ◆ accessibilityContainer

- (id) accessibilityContainer |  |  |

Provided by category FlutterTouchInterceptingView(Tests).

## ◆ blockGesture

- (void) blockGesture |  |  |

Definition at line 512 of file FlutterPlatformViews.mm.

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

## ◆ embeddedView

- (UIView*) embeddedView |  |  |

## ◆ initWithEmbeddedView:platformViewsController:gestureRecognizersBlockingPolicy:

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

Definition at line 512 of file FlutterPlatformViews.mm.

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

## ◆ releaseGesture

- (void) releaseGesture |  |  |

Definition at line 512 of file FlutterPlatformViews.mm.

559 {
560 self.delayingRecognizer.state = UIGestureRecognizerStateFailed;
561 }

## Property Documentation

## ◆ flutterAccessibilityContainer

- (id) flutterAccessibilityContainer
| readwritenonatomicretain

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