Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.19 KB | None | 0 0
  1. Struct userModel {
  2.    var firstName: String
  3.    var lastName: String
  4.    var userID: int
  5.    var weight: float?
  6.    var age: int?
  7.    var email: String
  8.    var country: String?
  9.    var height: float?
  10.    var goalWeight: float?
  11.  
  12.    Init( fname: String, lname: String, ID: Int, userWeight: float?, userAge: int?, userEmail: String, userCountry: String?, userHeight: float?,  userGoalWeight: float?){
  13.       self.firstName = fname
  14.       self.lastName = lname
  15.       self.userID = ID
  16.       self.weight = userWeight
  17.       self.age = userAge
  18.       self.email = userEmail
  19.       self.country = userCountry
  20.       self.height = userHeight
  21.       self.goalWeight = userGoalWeight
  22.    }
  23.  
  24.  
  25. }
  26.  
  27. Extention userModel{
  28.    func validateUserForLogin(username: String,  password: String) -> Bool{
  29.       //check the username and password against a database
  30.       If username && password {
  31.          //if the password is good to go return true
  32.          Return true
  33.       }else{
  34.          //Display popup error
  35.          Return false
  36.       }
  37.    }
  38.    Mutating func update(userWeight: float){
  39.       Self.weight = userWeight
  40.    }
  41.    Mutating func update(userHeight: float){
  42.       Self.height = userHeight
  43.    }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement