Skip to content
Permalink
Browse files
Merge pull request #8 from thomasv5/generatorFeature
Generator feature
  • Loading branch information
thomasv5 committed Nov 25, 2020
2 parents 2fb2632 + afd0121 commit 2057cc03c420dc91bd95803963ad77caf6e83262
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 46 deletions.
@@ -18,6 +18,7 @@
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 */; };
7C175467256D47AE00E6685E /* GenerateSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C175466256D47AE00E6685E /* GenerateSelection.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
@@ -55,6 +56,7 @@
7C17545B256830FC00E6685E /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
7C17545D25683E1000E6685E /* GeneratorDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneratorDisplay.swift; sourceTree = "<group>"; };
7C1754602568624200E6685E /* CalorieCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalorieCalculator.swift; sourceTree = "<group>"; };
7C175466256D47AE00E6685E /* GenerateSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateSelection.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -140,6 +142,7 @@
children = (
7C17545B256830FC00E6685E /* Menu.swift */,
7C17545D25683E1000E6685E /* GeneratorDisplay.swift */,
7C175466256D47AE00E6685E /* GenerateSelection.swift */,
7C1754602568624200E6685E /* CalorieCalculator.swift */,
);
path = ViewControllers;
@@ -281,6 +284,7 @@
7C17542725680F4300E6685E /* AppDelegate.swift in Sources */,
7C17545E25683E1100E6685E /* GeneratorDisplay.swift in Sources */,
7C17545C256830FC00E6685E /* Menu.swift in Sources */,
7C175467256D47AE00E6685E /* GenerateSelection.swift in Sources */,
7C17542925680F4300E6685E /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Binary file not shown.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "088A9208-DA12-49D5-8D54-03BE8E29FC61"
type = "1"
version = "2.0">
</Bucket>
@@ -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
}
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Workout.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

@@ -0,0 +1,42 @@
//
// GenerateSelection.swift
// FitnessApp
//
// Created by Varun Thomas on 24/11/2020.
// Copyright © 2020 Varun Thomas. All rights reserved.
//
import UIKit

protocol userSelectionDelegate {
func generate(kg: String, months: String)
}


class GenerateSelection: UIViewController {

// user inputs
@IBOutlet weak var kg: UITextField!
@IBOutlet weak var months: UITextField!




var generateDelegate:userSelectionDelegate!

override func viewDidLoad() {
super.viewDidLoad()
}

// generate button tapped
@IBAction func GenerateButtonTapped(_ sender: UIButton) {
let k = kg.text!
let m = months.text!
generateDelegate.generate(kg: k , months: m)
dismiss(animated: true, completion: nil)
}



}
@@ -10,9 +10,46 @@ import UIKit

class GeneratorDisplay: UIViewController {

override func viewDidLoad() {
// linking the images from the view to the code
@IBOutlet weak var Workout1: UIImageView!
@IBOutlet weak var Workout2: UIImageView!
@IBOutlet weak var Workout3: UIImageView!


override func viewDidLoad() {
super.viewDidLoad()

}
@IBAction func presentSecondViewController() {

let secondVC = storyboard?.instantiateViewController(identifier: "GenerateSelection") as! GenerateSelection
secondVC.generateDelegate = self
secondVC.modalPresentationStyle = .fullScreen
secondVC.modalTransitionStyle = .crossDissolve
present(secondVC, animated: true, completion: nil)
}





// let generatorVC = "GeneratorDisplay"


//generatorVC.selection


}

extension GeneratorDisplay: userSelectionDelegate {
func generate(kg: String, months: String) {

if kg == "2" && months == "2" {
Workout1.image = UIImage(named: "Workout" )
}
}

}

0 comments on commit 2057cc0

Please sign in to comment.