Hello everyone! I'm new in swift, so I have some problems. I try to make simple To-Do app. Main idea is have collection view with some tasks, you can tap on any of them and open detail view controller and in this VC you can open mode for editing and deleting it by presenting this mode. So, my problem is
- I chose random cell in my collection view
- Then I go to ViewController that shows me some details about this task
- Then I call editor of this task (I call it by presenting)
- Then I tap "Delete" and I want to dismiss this window (it's work well) and back to main scene (where's the list of all tasks) - and I can't, it doesn't work. And I have no idea, how it fix.
I
tried a lot of ways, but nothings
- self.navigationController?.popViewController(animated: true)
- self.view.window?.rootViewController!.dismiss(animated: true)
- navigationController?.popToViewController(HabitsViewController(), animated: true)
- didMove(toParent: HabitsViewController())
- navigationController?.dismiss(animated: true)
- navigationController!.popViewController(animated: true)
- navigationController!.popToRootViewController(animated: true)
Any ideas? Thanks
In Details
-
when open edit mode - add nameVC.delegate = self
-
extension VCName: ProtocolName , inside - navigationController?.popToRootViewController(animated: true)
In Editor
-
protocol + func ...
-
weak var delegate: VCNameDetail
-
func delete, delegate.nameFuncFromProtocol