Question: From my previous sourcecode: The source code: import UIKit / / Enum for BMI categories enum BMIStatus { case underweight case normal case overweight }

From my previous sourcecode:
The source code:
import UIKit
// Enum for BMI categories
enum BMIStatus {
case underweight
case normal
case overweight
}
// BMI Calculator class
class BMICalculator {
var weight: Double
var height: Double
var gender: String
init(weight: Double, height: Double, gender: String){
self.weight = weight
self.height = height
self.gender = gender
}
// Method to calculate BMI
func calculateBMI()-> Double {
return weight /(height * height)
}
// Method to determine BMI status
func getBMIStatus()-> BMIStatus {
let bmi = calculateBMI()
if bmi 18.5{
return .underweight
} else if bmi >=18.5 && bmi =24.9{
return .normal
} else {
return .overweight
}
}
}
class ViewController: UIViewController {
@IBOutlet weak var weightTextField: UITextField!
@IBOutlet weak var heightTextField: UITextField!
@IBOutlet weak var genderSegmentedControl: UISegmentedControl!
// Method called when calculate button is tapped
@IBAction func calculateBMI(_ sender: UIButton){
guard let weightText = weightTextField.text,
let heightText = heightTextField.text,
let weight = Double(weightText),
let height = Double(heightText) else {
// Show alert if input is invalid
showAlert(message: "Please enter valid weight and height")
return
}
let genderIndex = genderSegmentedControl.sel
Considering that a good percentage of employees use iPhones, you are being asked to develop the same biometric attendance application for iOS using Swift.
I. Project tasks in detail:
1. Create a signup screen, where you will have some text fields for getting data from the user like name and email.
2. Integrate email validations user should be able to proceed further only if entered email id is valid, else you should give an appropriate error message on the screen.
3. Create the next screen such that the user can set up his/her password.
4. Store data in the database after successful signup.
5. Show the sign-in screen to the user with two text fields , to get the mail id and password.
6. If the credentials entered by the user match the ones he had given at signup, then they should be able to log in.
7. Otherwise, show an error message on the screen.
8. After successful sign-in, the user should land on the home screen of the app.
9. On the home screen, add two buttons: -1 to check-in, and 2 to check-out.
10. Handle the following error cases:
a. If there is no internet
b. If there is no data returned from the server, instead it returns an error
Part 1
Create the app, test it on your iOS device or emulator/simulator, and take screenshots of all the screens, functionalities, and cases. (ULO 7.3,7.4)
For check-in and checkout (I.9):
Case 1: If the user has not registered his/her biometric, you need to show an alert asking the user to register their biometric with the app. When the biometric is registered successfully show a message that the biometric is registered successfully and save the biometric in the database.
Case 2: If the biometric is already registered, you have to ask for the biometric and when the user provides their biometric, you need to match those with the ones saved in the database.
a) If the biometric entered matches with the ones saved in the database, then check if the user is on office premises by matching the GPS location of his mobile phone with the office location. If the location matches, then you can let them check-in/out, otherwise, show an appropriate error message. You also need to save the date and time for every successful check-in/out.
b) If biometrics do not match then show an appropriate message to the user.
Case 3: If the user already checked in/out for the day, they should not be able to check-in/out again and you need to give a proper message to the user in this case.
You may use this dummy API to get sample data: JSONPlaceholder
Hint:
Create a single-screen app, with a button on it that may be titled fetch data.
With the tap of the button, you will be making the internet connection and will be calling the dummy API given in the question above.
Handle the following cases using Swifts error handling concept:
- when there will be no internet connection
- when there will be no data fetched from the internet
Part 2
Answer the following questions based on the app developed by you: (ULO 7.1)
A. Which error handling approach you have used in the app?
B. What is the significance of the protocols used by you while developing the app?
C. Explain significance of the Generic code in your app.
D. Share screenshots
 From my previous sourcecode: The source code: import UIKit // Enum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!