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
initweight: 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
return underweight
else if bmi && bmi
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 DoubleweightText
let height DoubleheightText else
Show alert if input is invalid
showAlertmessage: "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:
Create a signup screen, where you will have some text fields for getting data from the user like name and email.
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.
Create the next screen such that the user can set up hisher password.
Store data in the database after successful signup.
Show the signin screen to the user with two text fields to get the mail id and password.
If the credentials entered by the user match the ones he had given at signup, then they should be able to log in
Otherwise, show an error message on the screen.
After successful signin the user should land on the home screen of the app.
On the home screen, add two buttons: to checkin and to checkout.
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
Create the app, test it on your iOS device or emulatorsimulator and take screenshots of all the screens, functionalities, and cases. ULO
For checkin and checkout I:
Case : If the user has not registered hisher 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 : 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 checkinout otherwise, show an appropriate error message. You also need to save the date and time for every successful checkinout
b If biometrics do not match then show an appropriate message to the user.
Case : If the user already checked inout for the day, they should not be able to checkinout 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 singlescreen 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
Answer the following questions based on the app developed by you: ULO
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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
