I am trying to create a complex container controller with a split view that facilitates two containers with a variable height, each with its own nested view controller. There is a global gesture on the parent controller that allows the user to drag views anywhere in the container and move the “separator” between the views up and down. It also has some intelligent logic for determining the position threshold, which will expand either the view (or reset the position of the delimiter):


It works great. There is also a lot of code to create this, which I am happy to pass on, but I do not think it is relevant, so I will not omit it for now.
Now I'm trying to complicate the situation by adding a collection view to the bottom view:

I was able to process it so that I could scroll through the split view with decisive hard gestures and scroll through the collection view with a swift movement of the finger (swipe gesture, I suppose it is?), But it's really a sub-pairing experience: you can't pan the view and scroll the view collections at the same time, expecting the user to play similar, but different gestures in order to control the presentation, interaction is too difficult.
To try to solve this problem, I tried several solutions for delegates and protocols in which I found the position of the separator in split mode and turned on / off canCancelTouchesInView and / or isUserInteractionEnable in the collection view based on whether the bottom view is fully opened. This works at a specific point, but not in the following two scenarios:
- When the split view separator is in the default position, if the user clicks to the point where the bottom view is fully expanded, then continues panning, viewing the collection should begin by scrolling until the gesture ends.
- When the split view separator is at the top (the bottom container view is fully expanded) and the collection view is not up, if the user turns down, the collection view should scroll, instead of the split view separator, move until the collection view reaches its upper position, after which the split the view should return to its default position.
Here is an animation that illustrates this behavior:

With this in mind, I'm starting to think that the only way to solve the problem is to create a delegate method on a split view that reports on the collection view when the bottom view is at maximum height and then can intercept the parent panning gesture or will the screen touch the collection forward? But I do not know how to do this. If I am on the right track with a solution, my question is simple: How can I send or transmit a panorama gesture as a collection, and viewing the collection will be the same as if it was captured by him in the first place? Is there anything you can do with the pointInside or touches____ ?
If I cannot do it this way, how else can I solve this problem?
Update for bounty hunters: I had some fragmented luck creating a delegate method in the collection view and calling it in a container with a split view to set the shouldScroll property, with which I use some information about the pan and position direction to determine the scroll scroll. Then I return this value to the UIGestureRecognizerDelegate gestureRecognizer:shouldReceive touch: delegation method:
// protocol delegate protocol GalleryCollectionViewDelegate { var shouldScroll: Bool? { get } } // shouldScroll property private var _shouldScroll: Bool? = nil var shouldScroll: Bool { get { // Will attempt to retrieve delegate value, or self set value, or return false return self.galleryDelegate?.shouldScroll ?? self._shouldScroll ?? false } set { self._shouldScroll = newValue } } // UIGestureRecognizerDelegate method func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { return shouldScroll } // ---------------- // Delegate property/getter called on the split view controller and the logic: var shouldScroll: Bool? { get { return panTarget != self } } var panTarget: UIViewController! { get { // Use intelligent position detection to determine whether the pan should be // captured by the containing splitview or the gallery collectionview switch (viewState.currentPosition, viewState.pan?.directionTravelled, galleryScene.galleryCollectionView.isScrolled) { case (.top, .up?, _), (.top, .down?, true): return galleryScene default: return self } } }
This works fine when you start scrolling, but it doesn't work well once scrolling is enabled in the collection view, because the scroll gesture almost always cancels the pan gesture. I am wondering if I can connect something using gestureRecognizer:shouldRecognizeSimultaneouslyWith: but I'm not there yet.