Question: Need this solved in Swift using Xcode please Exercise - Type Properties and Methods Imagine you have an app that requires the user to log
Need this solved in Swift using Xcode please

Exercise - Type Properties and Methods Imagine you have an app that requires the user to log in. You may have a User struct similar to that shown below. However, in addition to keeping track of specific user information, you might want to have a way of knowing who the current logged in user is. Create a currentuser type property on the User struct below and assign it to a user object representing you. Now you can access the current user through the User struct. Print out the properties of currentUser. struct User var userName: String var email: String var age: Int There are other properties and actions associated with a User struct that might be good candidates for a type property or method. One might be a method for logging in. Go back and create a type method called LogIn(user:) where user is of type User. In the body of the method, assign the passed in user to the currentUser property, and print out a statement using the user's userName saying that the user has logged in. Below, call the LogIn(user:) method and pass in a different User instance than what you assigned to currentUser above. Observe the printout in the console. Exercise - Type Properties and Methods Imagine you have an app that requires the user to log in. You may have a User struct similar to that shown below. However, in addition to keeping track of specific user information, you might want to have a way of knowing who the current logged in user is. Create a currentuser type property on the User struct below and assign it to a user object representing you. Now you can access the current user through the User struct. Print out the properties of currentUser. struct User var userName: String var email: String var age: Int There are other properties and actions associated with a User struct that might be good candidates for a type property or method. One might be a method for logging in. Go back and create a type method called LogIn(user:) where user is of type User. In the body of the method, assign the passed in user to the currentUser property, and print out a statement using the user's userName saying that the user has logged in. Below, call the LogIn(user:) method and pass in a different User instance than what you assigned to currentUser above. Observe the printout in the console
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
