Skip to content

Commit

Permalink
BMI Calculator Exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethJacksonTech committed Nov 19, 2018
1 parent 8245abf commit f4961cc
Show file tree
Hide file tree
Showing 35 changed files with 324 additions and 30 deletions.
21 changes: 21 additions & 0 deletions BMI.xcodeproj/project.pbxproj
Expand Up @@ -7,21 +7,25 @@
objects = {

/* Begin PBXBuildFile section */
8A7C2F3E219CB339003210FE /* BMI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7C2F3D219CB339003210FE /* BMI.swift */; };
8AF0CBF7219A4C950001A6D0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AF0CBF6219A4C950001A6D0 /* AppDelegate.swift */; };
8AF0CBF9219A4C950001A6D0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AF0CBF8219A4C950001A6D0 /* ViewController.swift */; };
8AF0CBFC219A4C950001A6D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8AF0CBFA219A4C950001A6D0 /* Main.storyboard */; };
8AF0CBFE219A4C960001A6D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8AF0CBFD219A4C960001A6D0 /* Assets.xcassets */; };
8AF0CC01219A4C960001A6D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8AF0CBFF219A4C960001A6D0 /* LaunchScreen.storyboard */; };
8AF0CC0A219A601B0001A6D0 /* DarkMode.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 8AF0CC08219A601B0001A6D0 /* DarkMode.xcdatamodeld */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
8A7C2F3D219CB339003210FE /* BMI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMI.swift; sourceTree = "<group>"; };
8AF0CBF3219A4C950001A6D0 /* BMI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BMI.app; sourceTree = BUILT_PRODUCTS_DIR; };
8AF0CBF6219A4C950001A6D0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
8AF0CBF8219A4C950001A6D0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
8AF0CBFB219A4C950001A6D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8AF0CBFD219A4C960001A6D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8AF0CC00219A4C960001A6D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
8AF0CC02219A4C960001A6D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8AF0CC09219A601B0001A6D0 /* DarkMode.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = DarkMode.xcdatamodel; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -60,6 +64,8 @@
8AF0CBFD219A4C960001A6D0 /* Assets.xcassets */,
8AF0CBFF219A4C960001A6D0 /* LaunchScreen.storyboard */,
8AF0CC02219A4C960001A6D0 /* Info.plist */,
8AF0CC08219A601B0001A6D0 /* DarkMode.xcdatamodeld */,
8A7C2F3D219CB339003210FE /* BMI.swift */,
);
path = BMI;
sourceTree = "<group>";
Expand Down Expand Up @@ -135,7 +141,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8A7C2F3E219CB339003210FE /* BMI.swift in Sources */,
8AF0CBF9219A4C950001A6D0 /* ViewController.swift in Sources */,
8AF0CC0A219A601B0001A6D0 /* DarkMode.xcdatamodeld in Sources */,
8AF0CBF7219A4C950001A6D0 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -336,6 +344,19 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCVersionGroup section */
8AF0CC08219A601B0001A6D0 /* DarkMode.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
8AF0CC09219A601B0001A6D0 /* DarkMode.xcdatamodel */,
);
currentVersion = 8AF0CC09219A601B0001A6D0 /* DarkMode.xcdatamodel */;
path = DarkMode.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
};
/* End XCVersionGroup section */
};
rootObject = 8AF0CBEB219A4C950001A6D0 /* Project object */;
}
68 changes: 52 additions & 16 deletions BMI/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -1,93 +1,129 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "icon_20pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "icon_20pt@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "icon_29pt.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "icon_29pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "icon_29pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "icon_40pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "icon_40pt@3x.png",
"scale" : "3x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"size" : "60x60",
"filename" : "icon_57pt@1x.jpg",
"scale" : "1x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "icon_57pt@2x.jpg",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "icon_60pt@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "icon_60pt@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "icon_20pt-1.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "icon_40pt-1.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "icon_29pt-1.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "icon_29pt@2x-1.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "icon_40pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "icon_40pt@2x-1.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon_76pt.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon_76pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "icon_83.5@2x.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon.png",
"scale" : "1x"
}
],
Expand Down
Binary file added BMI/Assets.xcassets/AppIcon.appiconset/Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions BMI/Assets.xcassets/Button.imageset/Contents.json
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redButton.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added BMI/Assets.xcassets/Button.imageset/redButton.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions BMI/Assets.xcassets/Button2.imageset/Contents.json
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "redButton2.png",
"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.
21 changes: 21 additions & 0 deletions BMI/Assets.xcassets/Splash.imageset/Contents.json
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Splash.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added BMI/Assets.xcassets/Splash.imageset/Splash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions BMI/BMI.swift
@@ -0,0 +1,22 @@
//
// BMI.swift
// BMI
//
// Created by Kenneth W Jackson on 11/14/18.
// Copyright © 2018 Connections Digital. All rights reserved.
//

import Foundation


//bmi = (myBMI.weight * 703) / (myBMI.height * myBMI.height)
public struct BMICalculator {
func bmi(height: Int, weight: Int) -> Int {
let bmiCalc = 703 * weight / (height * height)
return bmiCalc
}
}




28 changes: 22 additions & 6 deletions BMI/Base.lproj/LaunchScreen.storyboard
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -11,15 +15,27 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Splash" translatesAutoresizingMaskIntoConstraints="NO" id="fsJ-Cd-2cY">
<rect key="frame" x="19.666666666666657" y="114.66666666666669" width="375" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" red="0.8901960784313725" green="0.14117647058823529" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="fsJ-Cd-2cY" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="00t-Bt-FJY"/>
<constraint firstItem="fsJ-Cd-2cY" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="Bw5-7S-laU"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="48.75" y="372.88732394366195"/>
</scene>
</scenes>
<resources>
<image name="Splash" width="375" height="667"/>
</resources>
</document>

0 comments on commit f4961cc

Please sign in to comment.