Orderella / PopupDialog

A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
http://www.mwfire.de
Other
3.96k stars 522 forks source link

How to pass data back from PopupDialog #286

Closed herotheone closed 6 years ago

herotheone commented 6 years ago

I am initializing my secondViewController like this. See below.

let StoryBoard = UIStoryboard.init(name: "Main", bundle: nil)

                let customVC = StoryBoard.instantiateViewController(withIdentifier: "popUpController") as! popUpController
                customVC.modalPresentationStyle = UIModalPresentationStyle.custom

                let popup = PopupDialog(viewController: customVC)

                self.present(popup, animated: true, completion: nil)

I want to call a function on mainVC from this dialog. That means i need to pass data back from this dialog. I can't use protocols and delegates unless i called the "performSegue" function which covers full size.

Do you have any idea how to pass data back to mainVC and run a function ?

herotheone commented 6 years ago

https://github.com/herotheone/myAdMobProject

This is the repo as an example project.

https://imgur.com/a/V16hFo6

https://imgur.com/a/vBmUZOF

mwfire commented 6 years ago

Hey @herotheone,

have a look at https://github.com/mwfire/PopupDialogCustomExample You should be able achieve what you are aiming for by passing a weak reference of PopupDialog to your custom view controller.

Does that help?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.