0

Example I have two UIViewController (I'll called A and B)

In A, when I click a button, I will show B with code:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier:"BController") as! BController
present(viewController, animated: true)

I don't use the navigate ViewController in Storyboard file. So, does it have any solution to when Applicaion in B, I swipe the screen from left edge and B will dismiss.

You can imagine what I want in this image

enter image description here

Tan Pham
  • 168
  • 1
  • 13

2 Answers2

1

Add A Controller to a NavigationController I make this by code:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier:"AController")
 let navigationController = UINavigationController(rootViewController: viewController)
 navigationController.isNavigationBarHidden = true
 self.present(navigationController, animated: true)

then from A

self.navigationController?.pushViewController(bController, animated: true)
Tan Pham
  • 168
  • 1
  • 13
0

You would need to write an interactive custom transition animation. Doing so is complex but well documented in tutorials and examples.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • For example see my answer here: https://stackoverflow.com/a/51580236/341994 That is a tab bar controller not a dismiss of a presented controller, but the mechanics are exactly the same. – matt Dec 12 '18 at 03:52
  • thanks, it will take more time to investigate. I noted and will read later. – Tan Pham Dec 12 '18 at 04:30