- قم بعمل Fork لهذا المجلد و clone وافتح المجلد من خلال Github Desktop
- قم بإنشاء مشروعاً جديداً واحفطه في هذا المجلد.
- أضف 2xTextField واحد ل weight و واحد ل height
- قم بإضافة زر، بحيث إذا تم الضغط على الزر يتم حساب الـ bmi
معادلة ال bmi
bmi = weight / (height * height)
- استعمل الدوال functions لحساب ال bmi وحالة الجسد (متين / طبيعي / نحيف )
بونص 🎁
- قم بعرض صور لكل حالة بشكل مختلف - إذا أدخل المستخدم رقماً خاطئ - أقل من الصفر أو أعلى من رقم غير معقول، لون الـ TextField باللون الأحمر - في حال الضغط على الزر وهناك مدخلات خاطئة قم بوضع نص أحمر أسفل الحقول واعرض فيه رسالة الخطأ
هنتات 👀
// This function might help you take a double value for BMI and convert it to a status using Switch statement.
func bmiStatus(bmi: Double) -> String{
switch bmi {
case ..<20: return "thin"
case 20..<25: return "normal"
case 25...: return "fat"
default: return ""
}
}