In my iOS application I have an option that opens a modal, in this modal I have a list of items, clicking on one of these items I show the details of the selected item.
The solution adopted today was to open the modal with the details inside the modal list, giving the user the option to go back to the modal with the list of items, without using navigationcontroller, I created a button where I give a dismiss in the controller. These modals are XIB files.
Below my call:
Open my modal List
class PrincipalViewController: UIViewController {
@IBAction func dependente(_ sender: Any) {
let modalViewController = ListaViewController()
modalViewController.modalPresentationStyle = .overFullScreen
modalViewController.modalTransitionStyle = .crossDissolve
present(modalViewController, animated: true, completion: nil)
}
}
Open item details
class ListaViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let modalViewController = DetalheViewController()
modalViewController.modalTransitionStyle = .flipHorizontal
present(modalViewController, animated: false, completion: nil)
}
}
I think it's not the right way, and I'm having trouble finding the right solution to make this navigation between manners, can anyone help me?
Thanks,