diff --git a/FitnessApp.xcodeproj/project.pbxproj b/FitnessApp.xcodeproj/project.pbxproj index 3d538cb..e8b663b 100644 --- a/FitnessApp.xcodeproj/project.pbxproj +++ b/FitnessApp.xcodeproj/project.pbxproj @@ -17,8 +17,9 @@ 7C17544C25680F4600E6685E /* FitnessAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C17544B25680F4600E6685E /* FitnessAppUITests.swift */; }; 7C17545C256830FC00E6685E /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C17545B256830FC00E6685E /* Menu.swift */; }; 7C17545E25683E1100E6685E /* GeneratorDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C17545D25683E1000E6685E /* GeneratorDisplay.swift */; }; - 7C1754612568624200E6685E /* CalorieCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C1754602568624200E6685E /* CalorieCalculator.swift */; }; + 7C1754612568624200E6685E /* CalorieCalculatorDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C1754602568624200E6685E /* CalorieCalculatorDisplay.swift */; }; 7C175467256D47AE00E6685E /* GenerateSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C175466256D47AE00E6685E /* GenerateSelection.swift */; }; + 7C175469256E987E00E6685E /* CalorieCalculatorSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C175468256E987E00E6685E /* CalorieCalculatorSelection.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -55,8 +56,9 @@ 7C17544D25680F4600E6685E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 7C17545B256830FC00E6685E /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = ""; }; 7C17545D25683E1000E6685E /* GeneratorDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneratorDisplay.swift; sourceTree = ""; }; - 7C1754602568624200E6685E /* CalorieCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalorieCalculator.swift; sourceTree = ""; }; + 7C1754602568624200E6685E /* CalorieCalculatorDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalorieCalculatorDisplay.swift; sourceTree = ""; }; 7C175466256D47AE00E6685E /* GenerateSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateSelection.swift; sourceTree = ""; }; + 7C175468256E987E00E6685E /* CalorieCalculatorSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalorieCalculatorSelection.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -143,7 +145,8 @@ 7C17545B256830FC00E6685E /* Menu.swift */, 7C17545D25683E1000E6685E /* GeneratorDisplay.swift */, 7C175466256D47AE00E6685E /* GenerateSelection.swift */, - 7C1754602568624200E6685E /* CalorieCalculator.swift */, + 7C1754602568624200E6685E /* CalorieCalculatorDisplay.swift */, + 7C175468256E987E00E6685E /* CalorieCalculatorSelection.swift */, ); path = ViewControllers; sourceTree = ""; @@ -280,9 +283,10 @@ buildActionMask = 2147483647; files = ( 7C17543125680F4300E6685E /* FitnessApp.xcdatamodeld in Sources */, - 7C1754612568624200E6685E /* CalorieCalculator.swift in Sources */, + 7C1754612568624200E6685E /* CalorieCalculatorDisplay.swift in Sources */, 7C17542725680F4300E6685E /* AppDelegate.swift in Sources */, 7C17545E25683E1100E6685E /* GeneratorDisplay.swift in Sources */, + 7C175469256E987E00E6685E /* CalorieCalculatorSelection.swift in Sources */, 7C17545C256830FC00E6685E /* Menu.swift in Sources */, 7C175467256D47AE00E6685E /* GenerateSelection.swift in Sources */, 7C17542925680F4300E6685E /* SceneDelegate.swift in Sources */, diff --git a/FitnessApp.xcodeproj/project.xcworkspace/xcuserdata/thomasv5.xcuserdatad/UserInterfaceState.xcuserstate b/FitnessApp.xcodeproj/project.xcworkspace/xcuserdata/thomasv5.xcuserdatad/UserInterfaceState.xcuserstate index 257cc0f..8747636 100644 Binary files a/FitnessApp.xcodeproj/project.xcworkspace/xcuserdata/thomasv5.xcuserdatad/UserInterfaceState.xcuserstate and b/FitnessApp.xcodeproj/project.xcworkspace/xcuserdata/thomasv5.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FitnessApp.xcodeproj/xcuserdata/thomasv5.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FitnessApp.xcodeproj/xcuserdata/thomasv5.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 455a4bf..bc16f8e 100644 --- a/FitnessApp.xcodeproj/xcuserdata/thomasv5.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/FitnessApp.xcodeproj/xcuserdata/thomasv5.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -3,4 +3,22 @@ uuid = "088A9208-DA12-49D5-8D54-03BE8E29FC61" type = "1" version = "2.0"> + + + + + + diff --git a/FitnessApp/AppDelegate.swift b/FitnessApp/AppDelegate.swift index aa52bc3..07ddb77 100644 --- a/FitnessApp/AppDelegate.swift +++ b/FitnessApp/AppDelegate.swift @@ -17,8 +17,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. // changed the colour of the - // UITabBar.appearance().barTintColor = .black - //UITabBar.appearance().tintColor = .red + UITabBar.appearance().barTintColor = .black + UITabBar.appearance().tintColor = .red return true } diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos.imageset/Contents.json b/FitnessApp/Assets.xcassets/FitnessGen-logos.imageset/Contents.json new file mode 100644 index 0000000..e6616f4 --- /dev/null +++ b/FitnessApp/Assets.xcassets/FitnessGen-logos.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "FitnessGen-logos.jpeg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos.imageset/FitnessGen-logos.jpeg b/FitnessApp/Assets.xcassets/FitnessGen-logos.imageset/FitnessGen-logos.jpeg new file mode 100644 index 0000000..e570351 Binary files /dev/null and b/FitnessApp/Assets.xcassets/FitnessGen-logos.imageset/FitnessGen-logos.jpeg differ diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos_black.imageset/Contents.json b/FitnessApp/Assets.xcassets/FitnessGen-logos_black.imageset/Contents.json new file mode 100644 index 0000000..d4eec33 --- /dev/null +++ b/FitnessApp/Assets.xcassets/FitnessGen-logos_black.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "FitnessGen-logos_black.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos_black.imageset/FitnessGen-logos_black.png b/FitnessApp/Assets.xcassets/FitnessGen-logos_black.imageset/FitnessGen-logos_black.png new file mode 100644 index 0000000..43a9e3b Binary files /dev/null and b/FitnessApp/Assets.xcassets/FitnessGen-logos_black.imageset/FitnessGen-logos_black.png differ diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos_transparent.imageset/Contents.json b/FitnessApp/Assets.xcassets/FitnessGen-logos_transparent.imageset/Contents.json new file mode 100644 index 0000000..84b2f67 --- /dev/null +++ b/FitnessApp/Assets.xcassets/FitnessGen-logos_transparent.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "FitnessGen-logos_transparent.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos_transparent.imageset/FitnessGen-logos_transparent.png b/FitnessApp/Assets.xcassets/FitnessGen-logos_transparent.imageset/FitnessGen-logos_transparent.png new file mode 100644 index 0000000..5933715 Binary files /dev/null and b/FitnessApp/Assets.xcassets/FitnessGen-logos_transparent.imageset/FitnessGen-logos_transparent.png differ diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos_white.imageset/Contents.json b/FitnessApp/Assets.xcassets/FitnessGen-logos_white.imageset/Contents.json new file mode 100644 index 0000000..ec53805 --- /dev/null +++ b/FitnessApp/Assets.xcassets/FitnessGen-logos_white.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "FitnessGen-logos_white.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/FitnessGen-logos_white.imageset/FitnessGen-logos_white.png b/FitnessApp/Assets.xcassets/FitnessGen-logos_white.imageset/FitnessGen-logos_white.png new file mode 100644 index 0000000..491df8b Binary files /dev/null and b/FitnessApp/Assets.xcassets/FitnessGen-logos_white.imageset/FitnessGen-logos_white.png differ diff --git a/FitnessApp/Assets.xcassets/Workout.imageset/Workout.jpg b/FitnessApp/Assets.xcassets/Workout.imageset/Workout.jpg deleted file mode 100644 index 8d7f50d..0000000 Binary files a/FitnessApp/Assets.xcassets/Workout.imageset/Workout.jpg and /dev/null differ diff --git a/FitnessApp/Assets.xcassets/Workout.imageset/Contents.json b/FitnessApp/Assets.xcassets/Workout1.imageset/Contents.json similarity index 88% rename from FitnessApp/Assets.xcassets/Workout.imageset/Contents.json rename to FitnessApp/Assets.xcassets/Workout1.imageset/Contents.json index 4e1d49e..bc43c40 100644 --- a/FitnessApp/Assets.xcassets/Workout.imageset/Contents.json +++ b/FitnessApp/Assets.xcassets/Workout1.imageset/Contents.json @@ -2,7 +2,7 @@ "images" : [ { "idiom" : "universal", - "filename" : "Workout.jpg", + "filename" : "Group 1.png", "scale" : "1x" }, { diff --git a/FitnessApp/Assets.xcassets/Workout1.imageset/Group 1.png b/FitnessApp/Assets.xcassets/Workout1.imageset/Group 1.png new file mode 100644 index 0000000..a247307 Binary files /dev/null and b/FitnessApp/Assets.xcassets/Workout1.imageset/Group 1.png differ diff --git a/FitnessApp/Assets.xcassets/Workout2.imageset/Contents.json b/FitnessApp/Assets.xcassets/Workout2.imageset/Contents.json new file mode 100644 index 0000000..bf1a6d4 --- /dev/null +++ b/FitnessApp/Assets.xcassets/Workout2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Group 2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/Workout2.imageset/Group 2.png b/FitnessApp/Assets.xcassets/Workout2.imageset/Group 2.png new file mode 100644 index 0000000..b3ef6ec Binary files /dev/null and b/FitnessApp/Assets.xcassets/Workout2.imageset/Group 2.png differ diff --git a/FitnessApp/Assets.xcassets/Workout3.imageset/Contents.json b/FitnessApp/Assets.xcassets/Workout3.imageset/Contents.json new file mode 100644 index 0000000..89ec848 --- /dev/null +++ b/FitnessApp/Assets.xcassets/Workout3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Group 3.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/Workout3.imageset/Group 3.png b/FitnessApp/Assets.xcassets/Workout3.imageset/Group 3.png new file mode 100644 index 0000000..f28c829 Binary files /dev/null and b/FitnessApp/Assets.xcassets/Workout3.imageset/Group 3.png differ diff --git a/FitnessApp/Assets.xcassets/calculator.imageset/Contents.json b/FitnessApp/Assets.xcassets/calculator.imageset/Contents.json new file mode 100644 index 0000000..7a6f6ba --- /dev/null +++ b/FitnessApp/Assets.xcassets/calculator.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons8-calculator-30.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/calculator.imageset/icons8-calculator-30.png b/FitnessApp/Assets.xcassets/calculator.imageset/icons8-calculator-30.png new file mode 100644 index 0000000..f6209f9 Binary files /dev/null and b/FitnessApp/Assets.xcassets/calculator.imageset/icons8-calculator-30.png differ diff --git a/FitnessApp/Assets.xcassets/icons8-calculator-31.imageset/Contents.json b/FitnessApp/Assets.xcassets/icons8-calculator-31.imageset/Contents.json new file mode 100644 index 0000000..7a6f6ba --- /dev/null +++ b/FitnessApp/Assets.xcassets/icons8-calculator-31.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons8-calculator-30.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/icons8-calculator-31.imageset/icons8-calculator-30.png b/FitnessApp/Assets.xcassets/icons8-calculator-31.imageset/icons8-calculator-30.png new file mode 100644 index 0000000..f6209f9 Binary files /dev/null and b/FitnessApp/Assets.xcassets/icons8-calculator-31.imageset/icons8-calculator-30.png differ diff --git a/FitnessApp/Assets.xcassets/icons8-dumbbell-31.imageset/Contents.json b/FitnessApp/Assets.xcassets/icons8-dumbbell-31.imageset/Contents.json new file mode 100644 index 0000000..ed2c7fc --- /dev/null +++ b/FitnessApp/Assets.xcassets/icons8-dumbbell-31.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons8-dumbbell-30.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/icons8-dumbbell-31.imageset/icons8-dumbbell-30.png b/FitnessApp/Assets.xcassets/icons8-dumbbell-31.imageset/icons8-dumbbell-30.png new file mode 100644 index 0000000..65edeb9 Binary files /dev/null and b/FitnessApp/Assets.xcassets/icons8-dumbbell-31.imageset/icons8-dumbbell-30.png differ diff --git a/FitnessApp/Assets.xcassets/icons8-dumbbell-90.imageset/Contents.json b/FitnessApp/Assets.xcassets/icons8-dumbbell-90.imageset/Contents.json new file mode 100644 index 0000000..907b49d --- /dev/null +++ b/FitnessApp/Assets.xcassets/icons8-dumbbell-90.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons8-dumbbell-90.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/icons8-dumbbell-90.imageset/icons8-dumbbell-90.png b/FitnessApp/Assets.xcassets/icons8-dumbbell-90.imageset/icons8-dumbbell-90.png new file mode 100644 index 0000000..e914749 Binary files /dev/null and b/FitnessApp/Assets.xcassets/icons8-dumbbell-90.imageset/icons8-dumbbell-90.png differ diff --git a/FitnessApp/Assets.xcassets/menu.imageset/Contents.json b/FitnessApp/Assets.xcassets/menu.imageset/Contents.json new file mode 100644 index 0000000..b488250 --- /dev/null +++ b/FitnessApp/Assets.xcassets/menu.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "menu.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/menu.imageset/menu.png b/FitnessApp/Assets.xcassets/menu.imageset/menu.png new file mode 100644 index 0000000..da081c0 Binary files /dev/null and b/FitnessApp/Assets.xcassets/menu.imageset/menu.png differ diff --git a/FitnessApp/Assets.xcassets/workout.imageset/Contents.json b/FitnessApp/Assets.xcassets/workout.imageset/Contents.json new file mode 100644 index 0000000..ed2c7fc --- /dev/null +++ b/FitnessApp/Assets.xcassets/workout.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icons8-dumbbell-30.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/workout.imageset/icons8-dumbbell-30.png b/FitnessApp/Assets.xcassets/workout.imageset/icons8-dumbbell-30.png new file mode 100644 index 0000000..65edeb9 Binary files /dev/null and b/FitnessApp/Assets.xcassets/workout.imageset/icons8-dumbbell-30.png differ diff --git a/FitnessApp/Assets.xcassets/workoutsBackground.imageset/Contents.json b/FitnessApp/Assets.xcassets/workoutsBackground.imageset/Contents.json new file mode 100644 index 0000000..41f1bba --- /dev/null +++ b/FitnessApp/Assets.xcassets/workoutsBackground.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "workoutsBackground.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/FitnessApp/Assets.xcassets/workoutsBackground.imageset/workoutsBackground.png b/FitnessApp/Assets.xcassets/workoutsBackground.imageset/workoutsBackground.png new file mode 100644 index 0000000..7905dfc Binary files /dev/null and b/FitnessApp/Assets.xcassets/workoutsBackground.imageset/workoutsBackground.png differ diff --git a/FitnessApp/Base.lproj/Main.storyboard b/FitnessApp/Base.lproj/Main.storyboard index 174f968..33c3b63 100644 --- a/FitnessApp/Base.lproj/Main.storyboard +++ b/FitnessApp/Base.lproj/Main.storyboard @@ -15,41 +15,39 @@ - - - + + + + + + + + + - - - - - - - + + + - + - + @@ -58,7 +56,7 @@ - + @@ -70,37 +68,146 @@ - + - + - + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - + @@ -110,189 +217,181 @@ - - + - - - - - - + + + + + - + + - - - + + + + + - - - - - + + + + - + - + - + - + - + - + - + - - - - - - - - - - - - + - + - + - + - + - - + + - + - - + + @@ -300,49 +399,63 @@ - - - + + + - + + - - - - - - + + + + + + + + + + + + + + - + - + @@ -350,117 +463,282 @@ - - - - + + + + + + - - + + + - - + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -473,13 +751,13 @@ - + - + - + @@ -492,13 +770,14 @@ - + - + + + + + - - - diff --git a/FitnessApp/ViewControllers/CalorieCalculator.swift b/FitnessApp/ViewControllers/CalorieCalculator.swift deleted file mode 100644 index f4d7a68..0000000 --- a/FitnessApp/ViewControllers/CalorieCalculator.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// CalorieCalculator.swift -// FitnessApp -// -// Created by Varun Thomas on 20/11/2020. -// Copyright © 2020 Varun Thomas. All rights reserved. -// - -import UIKit - -class CalorieCalculator: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - } - - - -} diff --git a/FitnessApp/ViewControllers/CalorieCalculatorDisplay.swift b/FitnessApp/ViewControllers/CalorieCalculatorDisplay.swift new file mode 100644 index 0000000..d4045ff --- /dev/null +++ b/FitnessApp/ViewControllers/CalorieCalculatorDisplay.swift @@ -0,0 +1,102 @@ +// +// CalorieCalculator.swift +// FitnessApp +// +// Created by Varun Thomas on 20/11/2020. +// Copyright © 2020 Varun Thomas. All rights reserved. +// + +import UIKit + +class CalorieCalculatorDisplay: UIViewController { + + // Display objects + + @IBOutlet weak var BMI: UILabel! + @IBOutlet weak var BMR: UILabel! + @IBOutlet weak var wClass: UILabel! + @IBOutlet weak var BMI_info: UILabel! + @IBOutlet weak var BMR_info: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + UITabBar.appearance().barTintColor = .black + UITabBar.appearance().tintColor = .red + + } + + // presenting the CalculatorSelection page when user clicks button + @IBAction func presentSecondViewController() { + + let calculatorVC = storyboard?.instantiateViewController(identifier: "CalorieCalculatorSelection") as! CalorieCalculatorSelection + calculatorVC.calculatorDelegate = self + calculatorVC.modalPresentationStyle = .fullScreen + calculatorVC.modalTransitionStyle = .crossDissolve + present(calculatorVC, animated: true, completion: nil) + } + + +} + + + +// logic to display calorie calculations when user selects and clicks on calculate button on the generateSelection page. + + +extension CalorieCalculatorDisplay: userDataDelegate { + + func calculate(age: Float32, sex: String, Height: Float32, Weight: Float32) { + + //BMI SECTION + + var userBMI:Float32 + userBMI = Weight / (Height * Height) + + switch userBMI{ + + case 0.0..<18.5: + BMI.text = String(format: "%.2f", userBMI) + wClass.text = "UNDERWEIGHT" + BMI_info.text = "You are UNDERWIEGHT, your BMR need to be between: 18.5 and 24.9 to be considered healthy." + + case 18.5..<24.9: + BMI.text = String(format: "%.2f", userBMI) + wClass.text = "HEALTHY" + BMI_info.text = "You are HEALTHY!, make sure your BMR is always between 18.5 and 24.9, in order to remain Healthy. " + + case 25..<29.9: + BMI.text = String(format: "%.2f", userBMI) + wClass.text = "OVERWEIGHT" + BMI_info.text = "You are OVERWIEGHT, your BMR need to be between: 18.5 and 24.9 to be considered healthy." + + case 30..<39.9: + wClass.text = "OBESE" + BMI.text = String(format: "%.2f", userBMI) + BMI_info.text = "You are OBESE, your BMR need to be between: 18.5 and 24.9 to be considered healthy." + + default: + BMI.text = String(format: "%.2f", userBMI) + wClass.text = "not within range" + + } + + + // BMR SECTION + var userBMR:Float32 + + //bmr if the user is male + if sex == "male"{ + userBMR = (10 * Weight) + (625 * Height) - (5 * age) + 5 + BMR.text = String(format: "%.2f", userBMR) + BMR_info.text = "This is the amount of calories you require everyday to maintain your current wieght. " + + } + //bmr if the user is female + else { + userBMR = (10 * Weight) + (625 * Height) - (5 * age) - 161 + BMR.text = String(format: "%.2f", userBMR ) + BMR_info.text = "This is the amount of calories you require everyday to maintain your current weight. " + } +} + +} diff --git a/FitnessApp/ViewControllers/CalorieCalculatorSelection.swift b/FitnessApp/ViewControllers/CalorieCalculatorSelection.swift new file mode 100644 index 0000000..4c8f5bb --- /dev/null +++ b/FitnessApp/ViewControllers/CalorieCalculatorSelection.swift @@ -0,0 +1,55 @@ +// +// CalorieCalculatorSelection.swift +// FitnessApp +// +// Created by Varun Thomas on 25/11/2020. +// Copyright © 2020 Varun Thomas. All rights reserved. +// + +import UIKit + + +// define a new Protocol + +protocol userDataDelegate { + func calculate(age: Float32, sex: String, Height: Float32, Weight: Float32) +} + + +class CalorieCalculatorSelection: UIViewController { + + // user inputs + @IBOutlet weak var UserAge: UITextField! + @IBOutlet weak var UserSex: UITextField! + @IBOutlet weak var UserHeight: UITextField! + @IBOutlet weak var UserWeight: UITextField! + + + + //define a delegate property + var calculatorDelegate: userDataDelegate! + + //loading GUI + override func viewDidLoad() { + super.viewDidLoad() + UITabBar.appearance().barTintColor = .black + UITabBar.appearance().tintColor = .red + + } + + + + //calculator button tapped + + @IBAction func calculatorButtonTapped(_ sender: UIButton) { + + let a = UserAge.text! + let s = UserSex.text! + let h = UserHeight.text! + let w = UserWeight.text! + + calculatorDelegate.calculate(age: Float32(a)!, sex: s, Height: Float32(h)!, Weight: Float32(w)!) + dismiss(animated: true, completion: nil) + } + +} diff --git a/FitnessApp/ViewControllers/GenerateSelection.swift b/FitnessApp/ViewControllers/GenerateSelection.swift index acf6c3d..736104a 100644 --- a/FitnessApp/ViewControllers/GenerateSelection.swift +++ b/FitnessApp/ViewControllers/GenerateSelection.swift @@ -9,7 +9,7 @@ import UIKit protocol userSelectionDelegate { - func generate(kg: String, months: String) + func generate(kg: String, weeks: String) } @@ -17,7 +17,8 @@ class GenerateSelection: UIViewController { // user inputs @IBOutlet weak var kg: UITextField! - @IBOutlet weak var months: UITextField! + + @IBOutlet weak var weeks: UITextField! @@ -26,14 +27,16 @@ class GenerateSelection: UIViewController { override func viewDidLoad() { super.viewDidLoad() + UITabBar.appearance().barTintColor = .black + UITabBar.appearance().tintColor = .red } // generate button tapped @IBAction func GenerateButtonTapped(_ sender: UIButton) { let k = kg.text! - let m = months.text! - generateDelegate.generate(kg: k , months: m) + let w = weeks.text! + generateDelegate.generate(kg: k , weeks: w) dismiss(animated: true, completion: nil) } diff --git a/FitnessApp/ViewControllers/GeneratorDisplay.swift b/FitnessApp/ViewControllers/GeneratorDisplay.swift index 9276ab7..b91b0e1 100644 --- a/FitnessApp/ViewControllers/GeneratorDisplay.swift +++ b/FitnessApp/ViewControllers/GeneratorDisplay.swift @@ -6,21 +6,66 @@ // Copyright © 2020 Varun Thomas. All rights reserved. // +// + import UIKit class GeneratorDisplay: UIViewController { - // linking the images from the view to the code +// titles and textfields for the workout list: - @IBOutlet weak var Workout1: UIImageView! - @IBOutlet weak var Workout2: UIImageView! - @IBOutlet weak var Workout3: UIImageView! - + //images and backgrounds + + @IBOutlet weak var workoutBackground: UIImageView! + @IBOutlet weak var workoutBackground3: UIImageView! + @IBOutlet weak var workoutBackground2: UIImageView! + + + + //titles + @IBOutlet weak var Day1Calories: UILabel! + @IBOutlet weak var Day2Calories: UILabel! + @IBOutlet weak var Day3Calories: UILabel! + @IBOutlet weak var TotalCalorieTitle: UILabel! + @IBOutlet weak var weeklyCalories: UILabel! + @IBOutlet weak var plan: UILabel! + + //textfields: + + //day1 display + @IBOutlet weak var c1: UILabel! + @IBOutlet weak var sq1: UILabel! + @IBOutlet weak var sk1: UILabel! + @IBOutlet weak var jj1: UILabel! + @IBOutlet weak var j1: UILabel! - override func viewDidLoad() { + //day2 display + @IBOutlet weak var c2: UILabel! + @IBOutlet weak var sq2: UILabel! + @IBOutlet weak var sk2: UILabel! + @IBOutlet weak var jj2: UILabel! + @IBOutlet weak var j2: UILabel! + + + //day 3 display + @IBOutlet weak var C3: UILabel! + @IBOutlet weak var sq3: UILabel! + @IBOutlet weak var sk3: UILabel! + @IBOutlet weak var jj3: UILabel! + @IBOutlet weak var j3: UILabel! + + + + + //loading up the user interface for Generator Display page + override func viewDidLoad() { super.viewDidLoad() + UITabBar.appearance().barTintColor = .black + UITabBar.appearance().tintColor = .red } + + // presenting the GenerateSelection page when user clicks button @IBAction func presentSecondViewController() { let secondVC = storyboard?.instantiateViewController(identifier: "GenerateSelection") as! GenerateSelection @@ -30,26 +75,140 @@ class GeneratorDisplay: UIViewController { present(secondVC, animated: true, completion: nil) } - - - - - // let generatorVC = "GeneratorDisplay" - - - - //generatorVC.selection - - + } + + +// logic to display workouts when user selects and clicks on generate button on the generateSelection page. + extension GeneratorDisplay: userSelectionDelegate { - func generate(kg: String, months: String) { + func generate(kg: String, weeks: String) { + + + let Day1Array = [c1 , sq1, sk1, jj1, j1] + let Day2Array = [c2, sq2, sk2, jj2, j2] + let Day3Array = [C3, sq3, sk3, jj3, j3] - if kg == "2" && months == "2" { - Workout1.image = UIImage(named: "Workout" ) + //calories are calculated + let totalCalories = (Int(kg)! * 7700) / Int(weeks)! + let day1Calories = (40 * totalCalories)/100 + let day2Calories = (35 * totalCalories)/100 + let day3Calories = (25 * totalCalories)/100 + + + //naming titles + plan.text = "\(kg) kg in \(weeks) weeks" + TotalCalorieTitle.text = "Total Calories: " + String(totalCalories * Int(weeks)!) + weeklyCalories.text = "Weekly Calories: " + String(totalCalories) + Day1Calories.text = "Day1: " + String(day1Calories) + "cal" + Day2Calories.text = "Day2: " + String(day2Calories) + "cal" + Day3Calories.text = "Day3: " + String(day3Calories) + "cal" + + + // workout list 1 + + + // creating workouts + let workout1 = generateWorkout(day1Calories) + let workout2 = generateWorkout(day2Calories) + let workout3 = generateWorkout(day3Calories) + + // assign workouts + + displayWorkouts(workout: workout1, display: Day1Array) + displayWorkouts(workout: workout2, display: Day2Array) + displayWorkouts(workout: workout3, display: Day3Array) + + //background image + workoutBackground.image = UIImage(named: "WorkoutBackground") + workoutBackground2.image = UIImage(named: "WorkoutBackground") + workoutBackground3.image = UIImage(named: "WorkoutBackground") } } + + + + + + + + + +extension GeneratorDisplay { + + + //FUNCTION which creates the workout list + + func generateWorkout(_ cal:Int) -> Array { + + var calorie = cal + let exercises = [11:"Jumping Jacks", 12: "Jogging", 10: "Cycling", 8: "Squats", 16: "Skipping"] + let key = [11,12,10,8,16] + + //ARRAY OF ALL EXERCISES + var aList = [String]() + + + //EXERCISES AND REPS + var cycling1 = 0 + var squats1 = 0 + var skipping1 = 0 + var jumpingJacks1 = 0 + var jogging1 = 0 + + + //CREATING A NEW WORKOUT PLAN + + //DAY 1 -> CREATING A LIST OF ALL EXERCISES IN PLAN A + while (calorie >= 0) { + //generating a random key + var randKey = Int.random(in: 0..<5) + randKey = key[randKey] + + //adding the random exercise onto new list + aList.append(exercises[randKey]!) + calorie = calorie - randKey + } + + + //counting mins for each exercise + for counter in 0...aList.count - 1{ + + let exercise = aList[counter] + switch exercise{ + case "Cycling": + cycling1 += 1 + case "Squats": + squats1 += 1 + case "Skipping": + skipping1 += 1 + case "Jumping Jacks": + jumpingJacks1 += 1 + case "Jogging": + jogging1 += 1 + default: + print("no exercise present") + } + } + print(cycling1) + + // combining both exercise & mins and storing them in an array + let ListOfworkouts = ["Cycling: " + String(cycling1) + " MINS ","Squats: " + String(squats1) + " MINS ", "Skipping: " + String(skipping1) + " MINS","Jumping Jacks: " + String(jumpingJacks1) + " MINS ", "Jogging: " + String(jogging1) + " MINS "] + + return ListOfworkouts + + } + + //function to display the workouts + + func displayWorkouts(workout: [String], display: [UILabel?]){ + + for i in 0...workout.count-1 { + // add code to display + display[i]!.text = workout[i] + } +} } diff --git a/FitnessAppTests/FitnessAppTests.swift b/FitnessAppTests/FitnessAppTests.swift index 7b6b77c..743367b 100644 --- a/FitnessAppTests/FitnessAppTests.swift +++ b/FitnessAppTests/FitnessAppTests.swift @@ -11,24 +11,20 @@ import XCTest class FitnessAppTests: XCTestCase { - override func setUp() { - // Put setup code here. This method is called before the invocation of each test method in the class. + // test cases for individual functions for the Calculatr Feature + + func calculate(){ + + + + } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - + + + + + + + + }