This sample Project make A View Being Dragged in View and Change its And other used views Height According to the Requirement and changes made
Project Hierarchy
--> Main View
--> 2 ContainerViews
--> Subviews in ContainerView
--> Container View At Bottom Draggable (Pan Gesture)
func addPanGesture()
{
let gesture : UIPanGestureRecognizer = UIPanGestureRecognizer(target: self, action:#selector(ViewController.handlePanGesture(panGesture:)))
self.bottomContainerView.addGestureRecognizer(gesture)
}
///Move view to required Position
panGesture.view?.frame = CGRect(x: 0, y: currentPoint.y, width: self.view.frame.size.width, height: self.view.frame.size.height-currentPoint.y)
self.upContainerView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height-(panGesture.view?.frame.height)!)
panGesture.setTranslation(CGPoint.zero, in: self.view)