Swift: segmented control with swipe gesture between views

I use UIContainer to switch between views using segmented control + gestures.

My storyboard is like this. enter image description here

Override func viewDidLoad() { super.viewDidLoad() var swipeRight = UISwipeGestureRecognizer(target: self, action: "respondToSwipeGesture:") swipeRight.direction = UISwipeGestureRecognizerDirection.Right self.view.addGestureRecognizer(swipeRight) 

}

I'm tired of a lot of open resources for Github, but written in objective-C? Can someone help

+5
source share
1 answer
 func respondToSwipeGesture(gestureReconizer: UISwipeGestureRecognizer) { self.performSegueWithIdentifier("SegueFromFirstScreenToSecond", sender: nil) } 

Here is the method you will need to implement if you have already created segue and named it "SegueFromFirstScreenToSecond". If you haven’t done a shogu, don’t worry! It's as simple as drawing from the first responder of the storyboard view to the next screen, and then setting the identifier to "SegueFromFirstScreenToSecond".

Good luck

+3
source

All Articles