Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SignUpVC: UIViewController {
- @IBOutlet weak var signUpButton: UIButton!
- var completionBlock: (() -> Void)?
- override func viewDidLoad() {
- super.viewDidLoad()
- signUpButton.fs_addCornerRadius(10)
- }
- @IBAction func dismissButton(_ sender: UIButton) {
- goAway()
- }
- private func goAway() {
- completionBlock!()
- }
- class func present(from pFrom: UIViewController, completion pCompletion: @escaping () -> Void) {
- let theStoryboard = UIStoryboard.init(name: "SignUp", bundle: nil)
- let signUpVC = theStoryboard.instantiateViewController(withIdentifier: "SignUpVC") as! SignUpVC
- signUpVC.completionBlock = pCompletion
- signUpVC.modalPresentationStyle = .overCurrentContext
- pFrom.present(signUpVC, animated: true)
- }
- }
- class SomeVC: UIViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- SignUpVC.present(from: self) {
- self.dismiss(animated: true)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement