Skip to content

Commit

Permalink
start counter
Browse files Browse the repository at this point in the history
  • Loading branch information
keoki33 committed Feb 26, 2020
1 parent f0f3dbd commit 5d00b27
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
Binary file not shown.
30 changes: 22 additions & 8 deletions EggTimer/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,28 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nJN-th-c5K" userLabel="Timer View">
<rect key="frame" x="0.0" y="571.5" width="374" height="246.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kgY-tu-Osy">
<rect key="frame" x="168.5" y="87" width="37" height="72"/>
<fontDescription key="fontDescription" type="system" pointSize="60"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="29" translatesAutoresizingMaskIntoConstraints="NO" id="Sog-qW-frp">
<rect key="frame" x="92" y="71.5" width="190" height="103.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kgY-tu-Osy">
<rect key="frame" x="76.5" y="0.0" width="37" height="72"/>
<fontDescription key="fontDescription" type="system" pointSize="60"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progressViewStyle="bar" progressImage="I" trackImage="I" translatesAutoresizingMaskIntoConstraints="NO" id="beE-Ic-enw">
<rect key="frame" x="20" y="101" width="150" height="2.5"/>
</progressView>
</subviews>
<constraints>
<constraint firstItem="beE-Ic-enw" firstAttribute="leading" secondItem="Sog-qW-frp" secondAttribute="leading" constant="20" symbolic="YES" id="1Ab-hS-jrT"/>
<constraint firstAttribute="trailing" secondItem="beE-Ic-enw" secondAttribute="trailing" id="3af-6q-cPm"/>
</constraints>
</stackView>
</subviews>
<constraints>
<constraint firstItem="kgY-tu-Osy" firstAttribute="centerY" secondItem="nJN-th-c5K" secondAttribute="centerY" id="Ief-4z-se3"/>
<constraint firstItem="kgY-tu-Osy" firstAttribute="centerX" secondItem="nJN-th-c5K" secondAttribute="centerX" id="JUL-ED-i29"/>
<constraint firstItem="Sog-qW-frp" firstAttribute="centerY" secondItem="nJN-th-c5K" secondAttribute="centerY" id="MwX-b8-uLU"/>
<constraint firstItem="Sog-qW-frp" firstAttribute="centerX" secondItem="nJN-th-c5K" secondAttribute="centerX" id="QP5-Zf-led"/>
</constraints>
</view>
</subviews>
Expand All @@ -146,6 +158,7 @@
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
<outlet property="cookingProgress" destination="beE-Ic-enw" id="YVa-tz-LhS"/>
<outlet property="counterDisplay" destination="kgY-tu-Osy" id="4ts-W0-QLA"/>
<outlet property="hardPic" destination="NEu-V5-iHi" id="5Mf-qg-5wA"/>
<outlet property="mediumPic" destination="Q3H-nl-7AG" id="4Z4-gc-Azy"/>
Expand All @@ -159,6 +172,7 @@
</scene>
</scenes>
<resources>
<image name="I" width="16" height="16"/>
<image name="hard_egg" width="287.5" height="366"/>
<image name="medium_egg" width="288" height="363"/>
<image name="soft_egg" width="287" height="365"/>
Expand Down
4 changes: 4 additions & 0 deletions EggTimer/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ViewController: UIViewController {
@IBOutlet weak var titleLabel: UILabel!

@IBOutlet weak var counterDisplay: UILabel!
@IBOutlet weak var cookingProgress: UIProgressView!


@IBAction func hardnessSelected(_ sender: UIButton) {
Expand Down Expand Up @@ -52,10 +53,13 @@ print("none") }
if counter > 0 {
print(counter)
counterDisplay.text = String(counter)
cookingProgress.progress = Float(counter / 10)

counter -= 1}
else {
counterDisplay.text = String(0)
titleLabel.text = "Done"
cookingProgress.progress = 1
gameTimer?.invalidate()
}
}
Expand Down

0 comments on commit 5d00b27

Please sign in to comment.