I am trying to reduce a view to a circle on swipe gesture (in any direction, fast or slow), similar to the experience on WhatsApp videoCall view. See images below, to get an idea of what I am trying to achieve.
I believe I need to use swipe gesture to achieve this, I've added a swipe gesture to my videoView, I am not sure what to do next.
In viewDidLoad I have the below
videoView.addGestureRecognizer(UISwipeGestureRecognizer(target: self, action: #selector(self.minimiseView) ))
I think I need to use gesture location ? and I also need to set the corner radius that increases with the swipe. Could some one please advise how I could achieve this ?
func minimiseView(gesture: UISwipeGestureRecognizer){
let location = gesture.location(in: self.view)
}
You basically want to do the following steps:
cornerRadius = distanceSwiped
Here’s a basic setup for how you might accomplish this:
This may not work entirely as I haven’t tested it but the basic idea should be enough to get you started.