Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Struct userModel {
- var firstName: String
- var lastName: String
- var userID: int
- var weight: float?
- var age: int?
- var email: String
- var country: String?
- var height: float?
- var goalWeight: float?
- Init( fname: String, lname: String, ID: Int, userWeight: float?, userAge: int?, userEmail: String, userCountry: String?, userHeight: float?, userGoalWeight: float?){
- self.firstName = fname
- self.lastName = lname
- self.userID = ID
- self.weight = userWeight
- self.age = userAge
- self.email = userEmail
- self.country = userCountry
- self.height = userHeight
- self.goalWeight = userGoalWeight
- }
- }
- Extention userModel{
- func validateUserForLogin(username: String, password: String) -> Bool{
- //check the username and password against a database
- If username && password {
- //if the password is good to go return true
- Return true
- }else{
- //Display popup error
- Return false
- }
- }
- Mutating func update(userWeight: float){
- Self.weight = userWeight
- }
- Mutating func update(userHeight: float){
- Self.height = userHeight
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement