So I need some help with dismissing a page sheet modal screen in iOS 13. I have looked at several posts and none helped.
iOS 13 Modals - Calling swipe dismissal programmatically
Looking at the 2nd answer I tried that but I kept getting that self was implicit and needed to be explicit. Tried researching that but didn't find to much.
All I want to do is have a Done button in the upper right of nav bar. When that button is pushed I need for it to connect to the database and save the data if it is valid (already implemented). Then it needs to dismiss the modal screen and refresh the table so that it gets the newest changes.
I have read up on delegates but didn't help much. I read a bit up on UIAdaptivePresentationControllerDelegate
and I understand the basics behind it and being able to pull to close the modal. But not sure how to duplicate that in the button. I did remember reading to set the presentation delegate. Or something to that effect.
let navigationController = segue.destination as! UINavigationController
let editSensorVC = navigationController.topViewController as! EditSensorViewController
navigationController.presentationController?.delegate = editSensorVC
It was saying this was how I set the Delegate, but not sure where to go from here.