From 994f1021de05e1b9ed38ecd841719094741b6b1c Mon Sep 17 00:00:00 2001 From: Ian Becker Date: Wed, 26 Aug 2020 11:11:37 -0700 Subject: [PATCH 01/13] Created model for our words --- .../WordMatchGame.xcodeproj/project.pbxproj | 20 +++++++++++++++++++ .../WordMatchGame/Model/WordsArray.swift | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 WordMatchGame/WordMatchGame/Model/WordsArray.swift diff --git a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj index c9ea326..b8d8f52 100644 --- a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj +++ b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 4B14265B24F6D4A500F6971D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265924F6D4A500F6971D /* Main.storyboard */; }; 4B14265D24F6D4A500F6971D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265C24F6D4A500F6971D /* Assets.xcassets */; }; 4B14266024F6D4A500F6971D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265E24F6D4A500F6971D /* LaunchScreen.storyboard */; }; + 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266A24F6DC5700F6971D /* WordsArray.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +23,7 @@ 4B14265C24F6D4A500F6971D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 4B14265F24F6D4A500F6971D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 4B14266124F6D4A500F6971D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 4B14266A24F6DC5700F6971D /* WordsArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArray.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,6 +56,8 @@ 4B14265224F6D4A500F6971D /* WordMatchGame */ = { isa = PBXGroup; children = ( + 4B14266C24F6DCED00F6971D /* ModelController */, + 4B14266924F6DC3400F6971D /* Model */, 4B14266824F6D59B00F6971D /* Views */, 4B14266724F6D57A00F6971D /* Resources */, ); @@ -80,6 +84,21 @@ path = Views; sourceTree = ""; }; + 4B14266924F6DC3400F6971D /* Model */ = { + isa = PBXGroup; + children = ( + 4B14266A24F6DC5700F6971D /* WordsArray.swift */, + ); + path = Model; + sourceTree = ""; + }; + 4B14266C24F6DCED00F6971D /* ModelController */ = { + isa = PBXGroup; + children = ( + ); + path = ModelController; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -153,6 +172,7 @@ files = ( 4B14265424F6D4A500F6971D /* AppDelegate.swift in Sources */, 4B14265624F6D4A500F6971D /* SceneDelegate.swift in Sources */, + 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WordMatchGame/WordMatchGame/Model/WordsArray.swift b/WordMatchGame/WordMatchGame/Model/WordsArray.swift new file mode 100644 index 0000000..914296e --- /dev/null +++ b/WordMatchGame/WordMatchGame/Model/WordsArray.swift @@ -0,0 +1,15 @@ +// +// WordsArray.swift +// WordMatchGame +// +// Created by Ian Becker on 8/26/20. +// Copyright © 2020 Ian Becker. All rights reserved. +// + +import Foundation + +class WordsArray { + + let words: [String] = [] + +} From 94215fee6ff678321d8672c78bb4de3c2eb1038b Mon Sep 17 00:00:00 2001 From: Todd Crandall Date: Wed, 26 Aug 2020 12:26:53 -0600 Subject: [PATCH 02/13] The storyboard outline is done. Implemented the buttons, text fields, and labels --- .../Views/Base.lproj/Main.storyboard | 230 +++++++++++++++++- 1 file changed, 228 insertions(+), 2 deletions(-) diff --git a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard index 659a5dc..aa2bdff 100644 --- a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard +++ b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard @@ -1,8 +1,234 @@ - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c1a9ad1b80aee83d38676fc0abb8c8b7d46e56c9 Mon Sep 17 00:00:00 2001 From: Todd Crandall Date: Wed, 26 Aug 2020 12:36:33 -0600 Subject: [PATCH 03/13] Fixed minor isses on Storyboard --- .../Views/Base.lproj/Main.storyboard | 256 +++++++++--------- 1 file changed, 129 insertions(+), 127 deletions(-) diff --git a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard index aa2bdff..a25647e 100644 --- a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard +++ b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard @@ -46,7 +46,7 @@ - + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - From ef9e3879c489f403bfd440a240a2e943cf2387e4 Mon Sep 17 00:00:00 2001 From: Ian Becker Date: Wed, 26 Aug 2020 13:05:57 -0700 Subject: [PATCH 04/13] Model controller done --- .../WordMatchGame.xcodeproj/project.pbxproj | 4 +++ .../WordMatchGame/Model/WordsArray.swift | 5 +++- .../WordsArrayController.swift | 25 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift diff --git a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj index b8d8f52..4002d48 100644 --- a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj +++ b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 4B14265D24F6D4A500F6971D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265C24F6D4A500F6971D /* Assets.xcassets */; }; 4B14266024F6D4A500F6971D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265E24F6D4A500F6971D /* LaunchScreen.storyboard */; }; 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266A24F6DC5700F6971D /* WordsArray.swift */; }; + 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -24,6 +25,7 @@ 4B14265F24F6D4A500F6971D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 4B14266124F6D4A500F6971D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4B14266A24F6DC5700F6971D /* WordsArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArray.swift; sourceTree = ""; }; + 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArrayController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -95,6 +97,7 @@ 4B14266C24F6DCED00F6971D /* ModelController */ = { isa = PBXGroup; children = ( + 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */, ); path = ModelController; sourceTree = ""; @@ -173,6 +176,7 @@ 4B14265424F6D4A500F6971D /* AppDelegate.swift in Sources */, 4B14265624F6D4A500F6971D /* SceneDelegate.swift in Sources */, 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */, + 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WordMatchGame/WordMatchGame/Model/WordsArray.swift b/WordMatchGame/WordMatchGame/Model/WordsArray.swift index 914296e..4c6e373 100644 --- a/WordMatchGame/WordMatchGame/Model/WordsArray.swift +++ b/WordMatchGame/WordMatchGame/Model/WordsArray.swift @@ -10,6 +10,9 @@ import Foundation class WordsArray { - let words: [String] = [] + let words: [String] + init(words: [String]) { + self.words = words + } } diff --git a/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift b/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift new file mode 100644 index 0000000..0e728b5 --- /dev/null +++ b/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift @@ -0,0 +1,25 @@ +// +// WordsArrayController.swift +// WordMatchGame +// +// Created by Ian Becker on 8/26/20. +// Copyright © 2020 Ian Becker. All rights reserved. +// + +import Foundation + +class WordsArrayController { + + static let shared = WordsArrayController() + + static let arrayOfWords: WordsArray = { + let words = WordsArray(words: ["Farm", "Oven", "Tree", "Fish", "Cart", "Port", "Rock", "Jump", "Bear", "Fork", "Bowl", "Wolf", "Lake", "Lava", "Hide", "Dark", "Moon", "Star", "Type", "Milk", "Iron", "Goat", "Blue", "Desk", "Plug", "Sock", "High", "Fort", "Baby", "Fall", "Nest", "Card", "Bush", "Pink", "Fire", "Deer", "Trip", "Sand", "Nail", "Yarn", "Tent", "Pail", "Cure", "Dirt", "Cord", "Wood", "Mesh", "Snow", "Salt", "Boat", "Land", "Ball", "Word", "Bolt", "Case", "Trap", "Claw", "Fang", "Hair", "Tire", "Bold", "Clay"]) + + return words + }() + + func generateRandomWordFrom(wordsArray: [String]) -> String { + guard let randomWord = wordsArray.randomElement() else { return "" } + return randomWord + } +} From a115b325d49606d7404e3498e5d235e146e9ebe9 Mon Sep 17 00:00:00 2001 From: Todd Crandall Date: Wed, 26 Aug 2020 14:33:52 -0600 Subject: [PATCH 05/13] Finished the Style Guide and added a Colors.xassets folder for the custom colors. --- .../WordMatchGame.xcodeproj/project.pbxproj | 16 ++++++++++ .../WordMatchGame/CustomUI/StyleGuide.swift | 29 +++++++++++++++++++ .../Resources/Colors.xcassets/Contents.json | 6 ++++ .../customDarkPurple.colorset/Contents.json | 20 +++++++++++++ .../customGreen.colorset/Contents.json | 20 +++++++++++++ .../customPink.colorset/Contents.json | 20 +++++++++++++ .../customPurple.colorset/Contents.json | 20 +++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 WordMatchGame/WordMatchGame/CustomUI/StyleGuide.swift create mode 100644 WordMatchGame/WordMatchGame/Resources/Colors.xcassets/Contents.json create mode 100644 WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customDarkPurple.colorset/Contents.json create mode 100644 WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customGreen.colorset/Contents.json create mode 100644 WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPink.colorset/Contents.json create mode 100644 WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPurple.colorset/Contents.json diff --git a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj index 4002d48..35849d8 100644 --- a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj +++ b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 4B14266024F6D4A500F6971D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265E24F6D4A500F6971D /* LaunchScreen.storyboard */; }; 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266A24F6DC5700F6971D /* WordsArray.swift */; }; 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */; }; + 9F631C2E24F6FD27006CFDE5 /* StyleGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */; }; + 9F631C3024F6FD41006CFDE5 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -26,6 +28,8 @@ 4B14266124F6D4A500F6971D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4B14266A24F6DC5700F6971D /* WordsArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArray.swift; sourceTree = ""; }; 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArrayController.swift; sourceTree = ""; }; + 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StyleGuide.swift; sourceTree = ""; }; + 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -58,6 +62,7 @@ 4B14265224F6D4A500F6971D /* WordMatchGame */ = { isa = PBXGroup; children = ( + 9F631C2C24F6FD0C006CFDE5 /* CustomUI */, 4B14266C24F6DCED00F6971D /* ModelController */, 4B14266924F6DC3400F6971D /* Model */, 4B14266824F6D59B00F6971D /* Views */, @@ -72,6 +77,7 @@ 4B14265324F6D4A500F6971D /* AppDelegate.swift */, 4B14265524F6D4A500F6971D /* SceneDelegate.swift */, 4B14265C24F6D4A500F6971D /* Assets.xcassets */, + 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */, 4B14265E24F6D4A500F6971D /* LaunchScreen.storyboard */, 4B14266124F6D4A500F6971D /* Info.plist */, ); @@ -102,6 +108,14 @@ path = ModelController; sourceTree = ""; }; + 9F631C2C24F6FD0C006CFDE5 /* CustomUI */ = { + isa = PBXGroup; + children = ( + 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */, + ); + path = CustomUI; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -161,6 +175,7 @@ buildActionMask = 2147483647; files = ( 4B14266024F6D4A500F6971D /* LaunchScreen.storyboard in Resources */, + 9F631C3024F6FD41006CFDE5 /* Colors.xcassets in Resources */, 4B14265D24F6D4A500F6971D /* Assets.xcassets in Resources */, 4B14265B24F6D4A500F6971D /* Main.storyboard in Resources */, ); @@ -176,6 +191,7 @@ 4B14265424F6D4A500F6971D /* AppDelegate.swift in Sources */, 4B14265624F6D4A500F6971D /* SceneDelegate.swift in Sources */, 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */, + 9F631C2E24F6FD27006CFDE5 /* StyleGuide.swift in Sources */, 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/WordMatchGame/WordMatchGame/CustomUI/StyleGuide.swift b/WordMatchGame/WordMatchGame/CustomUI/StyleGuide.swift new file mode 100644 index 0000000..55b0403 --- /dev/null +++ b/WordMatchGame/WordMatchGame/CustomUI/StyleGuide.swift @@ -0,0 +1,29 @@ +// +// StyleGuide.swift +// WordMatchGame +// +// Created by Todd Crandall on 8/26/20. +// Copyright © 2020 Ian Becker. All rights reserved. +// + +import UIKit + +extension UIView { + + func addCornerRadius(_ radius: CGFloat = 4) { + self.layer.cornerRadius = radius + } +}//End of Extension + +struct FontNames { + + static let helveticaBold = "Helvetica-Bold" +}//End of Struct + +extension UIColor { + + static let customDarkPurple = UIColor(named: "customDarkPurple")! + static let customGreen = UIColor(named: "customGreen") + static let customPink = UIColor(named: "customPink") + static let customPurple = UIColor(named: "customPurple") +}//End of Extension diff --git a/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/Contents.json b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customDarkPurple.colorset/Contents.json b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customDarkPurple.colorset/Contents.json new file mode 100644 index 0000000..c0b1d93 --- /dev/null +++ b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customDarkPurple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x43", + "green" : "0x2D", + "red" : "0x2A" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customGreen.colorset/Contents.json b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customGreen.colorset/Contents.json new file mode 100644 index 0000000..62ea166 --- /dev/null +++ b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customGreen.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xAD", + "green" : "0xE0", + "red" : "0x7B" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPink.colorset/Contents.json b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPink.colorset/Contents.json new file mode 100644 index 0000000..c851281 --- /dev/null +++ b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPink.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xB5", + "green" : "0x5B", + "red" : "0xF1" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPurple.colorset/Contents.json b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPurple.colorset/Contents.json new file mode 100644 index 0000000..27592df --- /dev/null +++ b/WordMatchGame/WordMatchGame/Resources/Colors.xcassets/customPurple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xE5", + "green" : "0x5D", + "red" : "0x9B" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} From 5386fc823595ff6ed525b7634dfa57e95e96b009 Mon Sep 17 00:00:00 2001 From: Colton Swapp Date: Wed, 26 Aug 2020 15:06:10 -0600 Subject: [PATCH 06/13] Created ViewControllers, added outlets. --- .../WordMatchGame.xcodeproj/project.pbxproj | 16 ++++++ .../WordsArrayController.swift | 2 +- .../Views/Base.lproj/Main.storyboard | 38 +++++++++++--- .../InitialViewController.swift | 35 +++++++++++++ .../WordGuessViewController.swift | 51 +++++++++++++++++++ 5 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 WordMatchGame/WordMatchGame/Views/ViewControllers/InitialViewController.swift create mode 100644 WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift diff --git a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj index 35849d8..3659677 100644 --- a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj +++ b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 4B14266024F6D4A500F6971D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4B14265E24F6D4A500F6971D /* LaunchScreen.storyboard */; }; 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266A24F6DC5700F6971D /* WordsArray.swift */; }; 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */; }; + 7525E4E824F70387008E9897 /* InitialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7525E4E724F70387008E9897 /* InitialViewController.swift */; }; + 7525E4EA24F70404008E9897 /* WordGuessViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7525E4E924F70404008E9897 /* WordGuessViewController.swift */; }; 9F631C2E24F6FD27006CFDE5 /* StyleGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */; }; 9F631C3024F6FD41006CFDE5 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */; }; /* End PBXBuildFile section */ @@ -28,6 +30,8 @@ 4B14266124F6D4A500F6971D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4B14266A24F6DC5700F6971D /* WordsArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArray.swift; sourceTree = ""; }; 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArrayController.swift; sourceTree = ""; }; + 7525E4E724F70387008E9897 /* InitialViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitialViewController.swift; sourceTree = ""; }; + 7525E4E924F70404008E9897 /* WordGuessViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordGuessViewController.swift; sourceTree = ""; }; 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StyleGuide.swift; sourceTree = ""; }; 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -87,6 +91,7 @@ 4B14266824F6D59B00F6971D /* Views */ = { isa = PBXGroup; children = ( + 7525E4E624F7036B008E9897 /* ViewControllers */, 4B14265924F6D4A500F6971D /* Main.storyboard */, ); path = Views; @@ -108,6 +113,15 @@ path = ModelController; sourceTree = ""; }; + 7525E4E624F7036B008E9897 /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 7525E4E724F70387008E9897 /* InitialViewController.swift */, + 7525E4E924F70404008E9897 /* WordGuessViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; 9F631C2C24F6FD0C006CFDE5 /* CustomUI */ = { isa = PBXGroup; children = ( @@ -191,7 +205,9 @@ 4B14265424F6D4A500F6971D /* AppDelegate.swift in Sources */, 4B14265624F6D4A500F6971D /* SceneDelegate.swift in Sources */, 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */, + 7525E4E824F70387008E9897 /* InitialViewController.swift in Sources */, 9F631C2E24F6FD27006CFDE5 /* StyleGuide.swift in Sources */, + 7525E4EA24F70404008E9897 /* WordGuessViewController.swift in Sources */, 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift b/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift index 0e728b5..0cadb18 100644 --- a/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift +++ b/WordMatchGame/WordMatchGame/ModelController/WordsArrayController.swift @@ -13,7 +13,7 @@ class WordsArrayController { static let shared = WordsArrayController() static let arrayOfWords: WordsArray = { - let words = WordsArray(words: ["Farm", "Oven", "Tree", "Fish", "Cart", "Port", "Rock", "Jump", "Bear", "Fork", "Bowl", "Wolf", "Lake", "Lava", "Hide", "Dark", "Moon", "Star", "Type", "Milk", "Iron", "Goat", "Blue", "Desk", "Plug", "Sock", "High", "Fort", "Baby", "Fall", "Nest", "Card", "Bush", "Pink", "Fire", "Deer", "Trip", "Sand", "Nail", "Yarn", "Tent", "Pail", "Cure", "Dirt", "Cord", "Wood", "Mesh", "Snow", "Salt", "Boat", "Land", "Ball", "Word", "Bolt", "Case", "Trap", "Claw", "Fang", "Hair", "Tire", "Bold", "Clay"]) + let words = WordsArray(words: ["Farm", "Oven", "Tree", "Fish", "Cart", "Port", "Rock", "Jump", "Bear", "Fork", "Bowl", "Wolf", "Lake", "Lava", "Hide", "Dark", "Moon", "Star", "Type", "Milk", "Iron", "Goat", "Blue", "Desk", "Plug", "Sock", "High", "Fort", "Baby", "Fall", "Nest", "Card", "Bush", "Pink", "Fire", "Deer", "Trip", "Sand", "Nail", "Yarn", "Tent", "Pail", "Cure", "Dirt", "Cord", "Wood", "Mesh", "Snow", "Salt", "Boat", "Land", "Ball", "Word", "Bolt", "Case", "Trap", "Claw", "Fang", "Hair", "Tire", "Bold", "Clay", "Gray", "Play", "Heat", "Pond", "Frog", "Moss", "Sage", "Game", "View", "Code", "Bump", "Song", "True", "Silk", "Gold", "Road", "Path", "Gate", "Hike", "Bark", "Bird", "Book", "Line", "Band", "Bass", "Rope", "Pole", "Meat", "Drum", "Calf", "Time", "Vial", "Foot", "Gear", "Date", "West", "Boar", "Pass", "Hand", "Swim", "Mark", "Next", "Done", "Well", "Bolt", "Nail", "Peak", "Name", "Bell", "Nose", "Pull", "Team", "Read", "Head", "Gulp", "Plus", "Gear", "Desk", "Twig", "Mars", "Flip", "Base", "Find", "Orca", "Hawk", "Dime", "Pick", "Sail", "Ring", "Cave", "Fear", "Rose", "Look", "Term", "Mode", "Lift", "Ship", "Talk", "Leaf", "Walk", "Camp", "File", "Hour", "Tube", "Dive", "Fuel", "Food", "Page", "Safe", "Draw", "Roll", "Plug", "Hill", "Wrap", "Cake", "Lamp", "Rain", "Hail", "Wind", "Tent"]) return words }() diff --git a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard index a25647e..c4dd60b 100644 --- a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard +++ b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard @@ -10,24 +10,29 @@ - + - + @@ -35,12 +40,12 @@ - + - + @@ -209,6 +214,18 @@ + + + + + + + + + + + + @@ -229,6 +246,15 @@ + diff --git a/WordMatchGame/WordMatchGame/Views/ViewControllers/InitialViewController.swift b/WordMatchGame/WordMatchGame/Views/ViewControllers/InitialViewController.swift new file mode 100644 index 0000000..3203d5e --- /dev/null +++ b/WordMatchGame/WordMatchGame/Views/ViewControllers/InitialViewController.swift @@ -0,0 +1,35 @@ +// +// InitialViewController.swift +// WordMatchGame +// +// Created by Colton Swapp on 8/26/20. +// Copyright © 2020 Ian Becker. All rights reserved. +// + +import UIKit + +class InitialViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + // MARK: - Actions + + // Generate Word Button tapped + @IBAction func generateWordButtonTapped(_ sender: Any) { + } + + + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + + +} diff --git a/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift b/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift new file mode 100644 index 0000000..3d7a595 --- /dev/null +++ b/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift @@ -0,0 +1,51 @@ +// +// WordGuessViewController.swift +// WordMatchGame +// +// Created by Colton Swapp on 8/26/20. +// Copyright © 2020 Ian Becker. All rights reserved. +// + +import UIKit + +class WordGuessViewController: UIViewController { + + // MARK: - Outlets + @IBOutlet weak var baseWordTextField: UITextField! + @IBOutlet weak var firstLetterTextField: UITextField! + @IBOutlet weak var secondLetterTextField: UITextField! + @IBOutlet weak var thirdLetterTextField: UITextField! + @IBOutlet weak var fourthLetterTextField: UITextField! + + @IBOutlet weak var firstLetterImageView: UIImageView! + @IBOutlet weak var secondLetterImageView: UIImageView! + @IBOutlet weak var thirdLetterImageView: UIImageView! + @IBOutlet weak var fourthLetterImageView: UIImageView! + + @IBOutlet weak var doneButton: UIButton! + + + // MARK: - LifeCycle Methods + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + // MARK: - Actions + + + // MARK: - Methods + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} From 046d924333fa470795c96a0bbd29f0fb066030c2 Mon Sep 17 00:00:00 2001 From: Colton Swapp Date: Wed, 26 Aug 2020 15:14:44 -0600 Subject: [PATCH 07/13] Dragged out a forgotten outlet for the final 'done' button --- WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard | 3 +++ .../Views/ViewControllers/WordGuessViewController.swift | 2 ++ 2 files changed, 5 insertions(+) diff --git a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard index c4dd60b..5a6e1c3 100644 --- a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard +++ b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard @@ -200,6 +200,9 @@ + + + diff --git a/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift b/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift index 3d7a595..8905f28 100644 --- a/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift +++ b/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift @@ -33,6 +33,8 @@ class WordGuessViewController: UIViewController { } // MARK: - Actions + @IBAction func doneButtonTapped(_ sender: Any) { + } // MARK: - Methods From a11afc536c43162b166c80e6a2fcaa1279d85735 Mon Sep 17 00:00:00 2001 From: Colton Swapp Date: Wed, 26 Aug 2020 16:47:31 -0600 Subject: [PATCH 08/13] Did a whole bunch of shiii --- .../WordMatchGame.xcodeproj/project.pbxproj | 4 + .../WordMatchGame/CustomUI/Labels.swift | 22 +++++ .../Views/Base.lproj/Main.storyboard | 49 ++++++---- .../WordGuessViewController.swift | 90 ++++++++++++++++--- 4 files changed, 138 insertions(+), 27 deletions(-) create mode 100644 WordMatchGame/WordMatchGame/CustomUI/Labels.swift diff --git a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj index 3659677..55d3128 100644 --- a/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj +++ b/WordMatchGame/WordMatchGame.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 4B14266E24F6DE1000F6971D /* WordsArrayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */; }; 7525E4E824F70387008E9897 /* InitialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7525E4E724F70387008E9897 /* InitialViewController.swift */; }; 7525E4EA24F70404008E9897 /* WordGuessViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7525E4E924F70404008E9897 /* WordGuessViewController.swift */; }; + 7525E4EC24F71D5B008E9897 /* Labels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7525E4EB24F71D5B008E9897 /* Labels.swift */; }; 9F631C2E24F6FD27006CFDE5 /* StyleGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */; }; 9F631C3024F6FD41006CFDE5 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */; }; /* End PBXBuildFile section */ @@ -32,6 +33,7 @@ 4B14266D24F6DE1000F6971D /* WordsArrayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordsArrayController.swift; sourceTree = ""; }; 7525E4E724F70387008E9897 /* InitialViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitialViewController.swift; sourceTree = ""; }; 7525E4E924F70404008E9897 /* WordGuessViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordGuessViewController.swift; sourceTree = ""; }; + 7525E4EB24F71D5B008E9897 /* Labels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Labels.swift; sourceTree = ""; }; 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StyleGuide.swift; sourceTree = ""; }; 9F631C2F24F6FD41006CFDE5 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -126,6 +128,7 @@ isa = PBXGroup; children = ( 9F631C2D24F6FD27006CFDE5 /* StyleGuide.swift */, + 7525E4EB24F71D5B008E9897 /* Labels.swift */, ); path = CustomUI; sourceTree = ""; @@ -204,6 +207,7 @@ files = ( 4B14265424F6D4A500F6971D /* AppDelegate.swift in Sources */, 4B14265624F6D4A500F6971D /* SceneDelegate.swift in Sources */, + 7525E4EC24F71D5B008E9897 /* Labels.swift in Sources */, 4B14266B24F6DC5700F6971D /* WordsArray.swift in Sources */, 7525E4E824F70387008E9897 /* InitialViewController.swift in Sources */, 9F631C2E24F6FD27006CFDE5 /* StyleGuide.swift in Sources */, diff --git a/WordMatchGame/WordMatchGame/CustomUI/Labels.swift b/WordMatchGame/WordMatchGame/CustomUI/Labels.swift new file mode 100644 index 0000000..d0fbb24 --- /dev/null +++ b/WordMatchGame/WordMatchGame/CustomUI/Labels.swift @@ -0,0 +1,22 @@ +// +// Labels.swift +// WordMatchGame +// +// Created by Colton Swapp on 8/26/20. +// Copyright © 2020 Ian Becker. All rights reserved. +// + +import UIKit + +class Labels: UILabel { + + override func awakeFromNib() { + <#code#> + } + + func updateFontTo(font: String) { + let size = self.font.pointSize + self.font = UIFont(name: font, size: size) + } + +} diff --git a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard index 5a6e1c3..0fe2317 100644 --- a/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard +++ b/WordMatchGame/WordMatchGame/Views/Base.lproj/Main.storyboard @@ -50,27 +50,41 @@ - - + + - - + - - + + @@ -193,7 +207,7 @@ + + + + + + The Goal of the game is to type in a word that has a matching letter in the same index position as the given word. Example: "WORD" has a letter in the first index position of "W", "WHAT" will meet the requirements. Then do it again for "O", "R", and "D". Do it in 30 seconds and you win! Don't...and you suck. + + + + + + + + + + + + + @@ -40,7 +60,7 @@ - + @@ -50,169 +70,149 @@ - - + + - - - - - - - - - - - - - - - - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - + + + + + + + + + + + + + + + + + @@ -278,4 +297,10 @@ + + + + + + diff --git a/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift b/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift index 29d6532..01ea7f7 100644 --- a/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift +++ b/WordMatchGame/WordMatchGame/Views/ViewControllers/WordGuessViewController.swift @@ -44,6 +44,8 @@ class WordGuessViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + self.hideKeyboardWhenTappedAround() + // Do any additional setup after loading the view. firstLetterTextField.delegate = self secondLetterTextField.delegate = self @@ -53,25 +55,60 @@ class WordGuessViewController: UIViewController { // MARK: - Actions @IBAction func doneButtonTapped(_ sender: Any) { - if firstLetterImageView.image == UIImage(systemName: "checkmark.circle.fill") && secondLetterImageView.image == UIImage(systemName: "checkmark.circle.fill") && thirdLetterImageView.image == UIImage(systemName: "checkmark.circle.fill") && fourthLetterImageView.image == UIImage(systemName: "checkmark.circle.fill") { - doneButton.backgroundColor = .red + + if firstLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) + && secondLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) + && thirdLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) + && fourthLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) { - navigationController?.popViewController(animated: true) + self.alertUserOfSuccess() } - // Else, perhaps present an AlertController saying that we have words that are not correct. } // MARK: - Methods + func redDoneButton() { + if firstLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) + && secondLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) + && thirdLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) + && fourthLetterImageView.image == UIImage(systemName: "checkmark.circle.fill")?.withTintColor(UIColor(red: 123/255, green: 224/255, blue: 173/255, alpha: 1), renderingMode: .alwaysOriginal) { + + self.doneButton.backgroundColor = .red + } + } + func alertUserOfSuccess() { + + let alertController = UIAlertController(title: "You Win!", message: "You should feel proud of your vocabulary!", preferredStyle: .alert) + let okAction = UIAlertAction(title: "I do feel proud, thanks!", style: .default) { (_) in + DispatchQueue.main.async { + self.navigationController?.popViewController(animated: true) + } + } + alertController.addAction(okAction) + present(alertController, animated: true) + } + + func alertUserOfLoss() { + let alertController = UIAlertController(title: "You're pitiful...", message: "That really wasn't that hard...what's the matter with you?", preferredStyle: .alert) + let okAction = UIAlertAction(title: "You're right... :(", style: .default) { (_) in + DispatchQueue.main.async { + self.navigationController?.popViewController(animated: true) + } + } + alertController.addAction(okAction) + present(alertController, animated: true) + } + func startTimer() { timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (Timer) in - if self.secondsRemaining > 0 { + if self.secondsRemaining >= 0 { self.timerLabel.text = self.timeFormatted(self.secondsRemaining) -// self.timerLabel.text = "\(self.secondsRemaining)" + self.redDoneButton() self.secondsRemaining -= 1 } else { Timer.invalidate() + self.alertUserOfLoss() } print("\(self.secondsRemaining)") } @@ -141,3 +178,15 @@ extension WordGuessViewController: UITextFieldDelegate { } } }//End of Class + +extension UIViewController { + func hideKeyboardWhenTappedAround() { + let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard)) + tap.cancelsTouchesInView = false + view.addGestureRecognizer(tap) + } + + @objc func dismissKeyboard() { + view.endEditing(true) + } +}