Created
September 23, 2022 04:40
-
-
Save scott-lydon/ae122a6ae6d25b114a48161e72f64367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UINavigationController { | |
// - MARK: Extracted reusable methods so that implementation changes reflect wherever used. | |
func viewController() { | |
navigationController.pushViewController(ViewController.instantiate(), animated: false) | |
} | |
func buySubscription() { | |
navigationController.pushViewController(BuyViewController.instantiate(), animated: true) | |
} | |
func createAccount() { | |
navigationController.pushViewController(CreateAccountViewController.instantiate(), animated: true) | |
} | |
} | |
// ---- | |
// call site: | |
class ViewController: UIViewController { | |
@IBAction func buyTapped(_ sender: Any) { | |
navigationController?.buySubscription() | |
} | |
@IBAction func createAccount(_ sender: Any) { | |
navigationController?.createAccount() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment