How to programmatically go back to the previous ViewController in Swift? (UINavigationController, unwind segue)
Hi everyone! I'm a beginner in iOS development with Swift and I've encountered a problem with navigation between screens.\n\nI have an app with two ViewControllers connected via Storyboard using a regular Show (Push) segue. The first screen is a list of items, and the second is detailed information. On the second screen, there's a "Back" button that should return the user back.\n\nI know that UINavigationController has a default "Back" button, but I need to make a custom button that programmatically triggers the back navigation. I tried using `self.dismiss(animated: true, completion: nil)` and `self.navigationController?.popViewController(animated: true)`, but in some cases nothing happens, and in others the app crashes with an error.\n\nHere's my button code:\n```swift\n@IBAc
No answers yet.
Log in to leave an answer