diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/Documentation/AppBreweryBanner.png b/Documentation/AppBreweryBanner.png deleted file mode 100644 index 767d0e95..00000000 Binary files a/Documentation/AppBreweryBanner.png and /dev/null differ diff --git a/Documentation/readme-end-banner.png b/Documentation/readme-end-banner.png deleted file mode 100644 index e12d9cac..00000000 Binary files a/Documentation/readme-end-banner.png and /dev/null differ diff --git a/EggTimer.xcodeproj/project.pbxproj b/EggTimer.xcodeproj/project.pbxproj index 73d40444..3ef9f07f 100644 --- a/EggTimer.xcodeproj/project.pbxproj +++ b/EggTimer.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - AD5C106222D34E35001E14A5 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = AD5C106122D34E35001E14A5 /* README.md */; }; AD5C106622D36212001E14A5 /* alarm_sound.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = AD5C106522D36212001E14A5 /* alarm_sound.mp3 */; }; ADF037EE22D332A800A69E9A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF037ED22D332A800A69E9A /* AppDelegate.swift */; }; ADF037F022D332A800A69E9A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF037EF22D332A800A69E9A /* SceneDelegate.swift */; }; @@ -18,7 +17,6 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - AD5C106122D34E35001E14A5 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; AD5C106522D36212001E14A5 /* alarm_sound.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = alarm_sound.mp3; sourceTree = ""; }; ADF037EA22D332A800A69E9A /* EggTimer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EggTimer.app; sourceTree = BUILT_PRODUCTS_DIR; }; ADF037ED22D332A800A69E9A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -44,7 +42,6 @@ ADF037E122D332A800A69E9A = { isa = PBXGroup; children = ( - AD5C106122D34E35001E14A5 /* README.md */, ADF037EC22D332A800A69E9A /* EggTimer */, ADF037EB22D332A800A69E9A /* Products */, ); @@ -100,7 +97,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1100; - LastUpgradeCheck = 1100; + LastUpgradeCheck = 1240; ORGANIZATIONNAME = "The App Brewery"; TargetAttributes = { ADF037E922D332A800A69E9A = { @@ -134,7 +131,6 @@ ADF037FA22D332AD00A69E9A /* LaunchScreen.storyboard in Resources */, AD5C106622D36212001E14A5 /* alarm_sound.mp3 in Resources */, ADF037F722D332AD00A69E9A /* Assets.xcassets in Resources */, - AD5C106222D34E35001E14A5 /* README.md in Resources */, ADF037F522D332A800A69E9A /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -200,6 +196,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -260,6 +257,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -293,12 +291,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = VZ82UHK6PR; INFOPLIST_FILE = EggTimer/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = co.appbrewery.EggTimer; + PRODUCT_BUNDLE_IDENTIFIER = com.blarnya.EggTimer; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -310,12 +309,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = VZ82UHK6PR; INFOPLIST_FILE = EggTimer/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = co.appbrewery.EggTimer; + PRODUCT_BUNDLE_IDENTIFIER = com.blarnya.EggTimer; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/eleanorkalu.xcuserdatad/UserInterfaceState.xcuserstate b/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/eleanorkalu.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..d897f314 Binary files /dev/null and b/EggTimer.xcodeproj/project.xcworkspace/xcuserdata/eleanorkalu.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/EggTimer.xcodeproj/xcuserdata/eleanorkalu.xcuserdatad/xcschemes/xcschememanagement.plist b/EggTimer.xcodeproj/xcuserdata/eleanorkalu.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..0f61c311 --- /dev/null +++ b/EggTimer.xcodeproj/xcuserdata/eleanorkalu.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + EggTimer.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/EggTimer/Base.lproj/Main.storyboard b/EggTimer/Base.lproj/Main.storyboard index 2df29d93..4af613e1 100644 --- a/EggTimer/Base.lproj/Main.storyboard +++ b/EggTimer/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -16,13 +17,13 @@ - + - + - - + - + + + + - - - @@ -62,16 +66,19 @@ - + + + + - - - @@ -85,16 +92,19 @@ - + + + + - - - @@ -109,21 +119,92 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + diff --git a/EggTimer/ViewController.swift b/EggTimer/ViewController.swift index 0d9d8d79..93fd2635 100644 --- a/EggTimer/ViewController.swift +++ b/EggTimer/ViewController.swift @@ -8,8 +8,74 @@ import UIKit + + class ViewController: UIViewController { + let softTime = 5 + let mediumTime = 7 + let hardTime = 12 + + var seconds = 60 + var timer = Timer() + var isTimerRunning = false + var resumeTapped = false + // create a dictionary with a key and a value + // let eggTimes = ["Soft": 5, "Medium": 7, "Hard": 12] + let eggTimes : [String: Int] = ["Soft": 5, "Medium": 7, "Hard": 12] + + // This method call initializes the timer. + // It specifies the timeInterval (how often the a method will be called) + // and the selector (the method being called). + // The interval is measured seconds so for it to perform like a standard clock + // we should set this argument to 1. + // + func runTimer() { + timer = Timer.scheduledTimer(timeInterval: 1, target: self, + selector: (#selector(ViewController.updateTimer)), + userInfo: nil, repeats: true) + } + + @objc func updateTimer() { + seconds -= 1 //This will decrement(count down)the seconds. + countdownTimer.text = String(seconds) //This will update the label. + } + - + @IBOutlet weak var countdownTimer: UILabel! + + @IBAction func startButtonTapped(_ sender: UIButton) { + runTimer() + } + + @IBAction func pauseButtonTapped(_ sender: UIButton) { + if resumeTapped == false { + timer.invalidate() + resumeTapped = true + } else { + runTimer() + resumeTapped = false + } + } + + @IBAction func resetButtonTapped(_ sender: UIButton) { + timer.invalidate() + seconds = 60 + countdownTimer.text = String(seconds) + } + + + @IBAction func hardnessSelected(_ sender: UIButton) { + // print(sender.currentTitle!) + + let hardness = sender.currentTitle! + + // the questions marks are stripped out with the ?? "" + print(eggTimes[hardness] ?? "") + + // alternatively, the longer way is use an IF Statement + } + + + } diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..62c4fba9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 EleanorKal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100755 index 36de94bc..00000000 --- a/README.md +++ /dev/null @@ -1,27 +0,0 @@ -![App Brewery Banner](Documentation/AppBreweryBanner.png) - -# Egg Timer - -## Our Goal - -This module will be a mix of tutorials and challenges. Most importantly, we want you to get comfortable with looking up how to do something you've never done before. In certain places of this module, you’ll need to follow the 5 step process you learnt in the Xylophone module and use Google search, StackOverflow and Apple Documentation to make your code do what you want it to. But there are also other parts where we’ll take you step-by-step through new Swift programming concepts. - -## What You'll Make - -You’ll be building a beautiful egg timer app to boil your eggs to perfection depending on how you prefer your eggs. - -## What you will learn - -* Swift Collection types - Dictionaries -* The Swift Timer API -* Conditional statements - IF/ELSE -* Conditional statements - Switch -* Functions with outputs -* How to use the ProgressView - - - ->This is a companion project to The App Brewery's Complete App Development Bootcamp, check out the full course at [www.appbrewery.co](https://www.appbrewery.co/) - -![End Banner](Documentation/readme-end-banner.png) -