Last active
January 8, 2019 12:22
-
-
Save Marchuck/fc6a44d8562d21735353a099989f2da6 to your computer and use it in GitHub Desktop.
passing data for new screen using prepare for segue
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
class LoginViewController { | |
var userName: String = "joe@doe.com" | |
let HOME_SEGUE = "HOME_SEGUE" | |
let FORGOT_PASSWORD_SEGUE = "FORGOT_PASSWORD_SEGUE" | |
func startHomeScreen(){ | |
self.performSegue(withIdentifier: HOME_SEGUE, sender: self) | |
} | |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
switch segue.identifier { | |
case HOME_SEGUE: | |
guard let homeScreen = segue.destination as? HomeTabsViewController else{ | |
return | |
} | |
homeScreen.userName = userName | |
break | |
case FORGOT_PASSWORD_SEGUE: | |
let forgotPasswordScreen = segue.destination as? ForgotPasswrodViewController | |
//todo: | |
break | |
default: break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment