Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. class SignUpVC: UIViewController {
  2. @IBOutlet weak var signUpButton: UIButton!
  3.  
  4. var completionBlock: (() -> Void)?
  5.  
  6. override func viewDidLoad() {
  7. super.viewDidLoad()
  8. signUpButton.fs_addCornerRadius(10)
  9. }
  10.  
  11. @IBAction func dismissButton(_ sender: UIButton) {
  12. goAway()
  13. }
  14.  
  15. private func goAway() {
  16. completionBlock!()
  17. }
  18.  
  19. class func present(from pFrom: UIViewController, completion pCompletion: @escaping () -> Void) {
  20. let theStoryboard = UIStoryboard.init(name: "SignUp", bundle: nil)
  21. let signUpVC = theStoryboard.instantiateViewController(withIdentifier: "SignUpVC") as! SignUpVC
  22. signUpVC.completionBlock = pCompletion
  23. signUpVC.modalPresentationStyle = .overCurrentContext
  24. pFrom.present(signUpVC, animated: true)
  25. }
  26. }
  27.  
  28. class SomeVC: UIViewController {
  29.  
  30. override func viewDidLoad() {
  31. super.viewDidLoad()
  32. SignUpVC.present(from: self) {
  33. self.dismiss(animated: true)
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement