 		}
 		
 		dismissCompletion?(completed)
+	}
+	
+	// MARK:- Presented view KVO
+	
+	override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
+		if keyPath == "transform" || keyPath == "frame", let view = object as? UIView {
+			let offset = view.frame.origin.y
+			updateRoundedMask(forOffset: offset)
+		}
+	}
+	
+	private func updateRoundedMask(forOffset offset: CGFloat) {
+		guard let roundedView = roundedView, let maskLayer = maskLayer else {
+			return
+		}
+		
+		roundedView.frame = CGRect(x: 0, y: offset, width: containerView!.bounds.width, height: 8)
+		maskLayer.frame = roundedView.bounds
+		
+		let radii = CGSize(width: roundedView.bounds.height, height: roundedView.bounds.height)
+		let boundsPath = UIBezierPath(rect: roundedView.bounds)
+		boundsPath.append(UIBezierPath(roundedRect: roundedView.bounds,
+		                               byRoundingCorners: [.topLeft, .topRight],
+		                               cornerRadii: radii))
+		
+		maskLayer.path = boundsPath.cgPath
 	}
 	
 	// MARK:- Gesture handling

			let containerView = containerView,
			let presentingViewSnapshotView = presentingViewSnapshotView,
			cachedContainerWidth != containerView.bounds.width
			else {
				return
		}
		
		cachedContainerWidth = containerView.bounds.width

			}, completion: { [weak self] _ in
				self?.presentingViewController.view.alpha = 0.8
				containerView.frame = CGRect(x: 0, y: statusBarHeight, width: containerView.frame.width, height: newHeight)
			}
		)
	}
