Advertisement
Guest User

Untitled

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