diff --git a/AdLibs/AdLibs.xcodeproj/project.pbxproj b/AdLibs/AdLibs.xcodeproj/project.pbxproj index a5b69b2..94dbd8a 100644 --- a/AdLibs/AdLibs.xcodeproj/project.pbxproj +++ b/AdLibs/AdLibs.xcodeproj/project.pbxproj @@ -7,43 +7,43 @@ objects = { /* Begin PBXBuildFile section */ + 0566EDE52411FBC7007EEBBC /* StoryTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0566EDE42411FBC7007EEBBC /* StoryTableViewCell.swift */; }; + 0566EDE72411FBDF007EEBBC /* StoryTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0566EDE62411FBDF007EEBBC /* StoryTableViewController.swift */; }; 05AD2A17240767E30051AC59 /* AdLibCreatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05AD2A16240767E30051AC59 /* AdLibCreatorViewController.swift */; }; - 05AD2A1924076A880051AC59 /* StorySelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05AD2A1824076A880051AC59 /* StorySelector.swift */; }; - 05AD2A1B24076E0C0051AC59 /* AdLib.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05AD2A1A24076E0C0051AC59 /* AdLib.swift */; }; 05AD2A1D24076E2D0051AC59 /* AdLibController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05AD2A1C24076E2D0051AC59 /* AdLibController.swift */; }; 05AD2A1F24077BD80051AC59 /* StoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05AD2A1E24077BD80051AC59 /* StoryViewController.swift */; }; + 381C8536240F687A0056DF8A /* Words.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381C8535240F687A0056DF8A /* Words.swift */; }; + 381C8538240F98460056DF8A /* Story.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381C8537240F98460056DF8A /* Story.swift */; }; 38AF8E862406FCC400608D01 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E852406FCC400608D01 /* AppDelegate.swift */; }; 38AF8E882406FCC400608D01 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E872406FCC400608D01 /* SceneDelegate.swift */; }; - 38AF8E8A2406FCC400608D01 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E892406FCC400608D01 /* ViewController.swift */; }; + 38AF8E8A2406FCC400608D01 /* WackyAdLibsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E892406FCC400608D01 /* WackyAdLibsViewController.swift */; }; 38AF8E8D2406FCC400608D01 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 38AF8E8B2406FCC400608D01 /* Main.storyboard */; }; 38AF8E8F2406FCC600608D01 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 38AF8E8E2406FCC600608D01 /* Assets.xcassets */; }; 38AF8E922406FCC600608D01 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 38AF8E902406FCC600608D01 /* LaunchScreen.storyboard */; }; 38AF8E9A24070B6200608D01 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E9924070B6200608D01 /* SettingsViewController.swift */; }; - 38AF8E9C24070F6100608D01 /* String+UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E9B24070F6100608D01 /* String+UserDefaults.swift */; }; - 38AF8EA024070FAF00608D01 /* ThemeHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8E9F24070FAF00608D01 /* ThemeHelper.swift */; }; - 38AF8EA524086A0800608D01 /* AdLibBookCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8EA424086A0800608D01 /* AdLibBookCollectionViewController.swift */; }; - 38AF8EA724086A2400608D01 /* AdLibBookCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8EA624086A2400608D01 /* AdLibBookCollectionViewCell.swift */; }; + 38AF8EAD240AF22000608D01 /* InformationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AF8EAC240AF22000608D01 /* InformationViewController.swift */; }; + 38FC6BAF240B3CCF007DFE79 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38FC6BAE240B3CCF007DFE79 /* Settings.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 0566EDE42411FBC7007EEBBC /* StoryTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryTableViewCell.swift; sourceTree = ""; }; + 0566EDE62411FBDF007EEBBC /* StoryTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryTableViewController.swift; sourceTree = ""; }; 05AD2A16240767E30051AC59 /* AdLibCreatorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdLibCreatorViewController.swift; sourceTree = ""; }; - 05AD2A1824076A880051AC59 /* StorySelector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorySelector.swift; sourceTree = ""; }; - 05AD2A1A24076E0C0051AC59 /* AdLib.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdLib.swift; sourceTree = ""; }; 05AD2A1C24076E2D0051AC59 /* AdLibController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdLibController.swift; sourceTree = ""; }; 05AD2A1E24077BD80051AC59 /* StoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryViewController.swift; sourceTree = ""; }; + 381C8535240F687A0056DF8A /* Words.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Words.swift; sourceTree = ""; }; + 381C8537240F98460056DF8A /* Story.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Story.swift; sourceTree = ""; }; 38AF8E822406FCC400608D01 /* AdLibs.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdLibs.app; sourceTree = BUILT_PRODUCTS_DIR; }; 38AF8E852406FCC400608D01 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38AF8E872406FCC400608D01 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - 38AF8E892406FCC400608D01 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 38AF8E892406FCC400608D01 /* WackyAdLibsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WackyAdLibsViewController.swift; sourceTree = ""; }; 38AF8E8C2406FCC400608D01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38AF8E8E2406FCC600608D01 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 38AF8E912406FCC600608D01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 38AF8E932406FCC600608D01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38AF8E9924070B6200608D01 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; - 38AF8E9B24070F6100608D01 /* String+UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+UserDefaults.swift"; sourceTree = ""; }; - 38AF8E9F24070FAF00608D01 /* ThemeHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeHelper.swift; sourceTree = ""; }; - 38AF8EA424086A0800608D01 /* AdLibBookCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdLibBookCollectionViewController.swift; sourceTree = ""; }; - 38AF8EA624086A2400608D01 /* AdLibBookCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdLibBookCollectionViewCell.swift; sourceTree = ""; }; + 38AF8EAC240AF22000608D01 /* InformationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InformationViewController.swift; sourceTree = ""; }; + 38FC6BAE240B3CCF007DFE79 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -60,7 +60,8 @@ 05AD2A122407670C0051AC59 /* Model */ = { isa = PBXGroup; children = ( - 05AD2A1A24076E0C0051AC59 /* AdLib.swift */, + 381C8535240F687A0056DF8A /* Words.swift */, + 381C8537240F98460056DF8A /* Story.swift */, ); path = Model; sourceTree = ""; @@ -69,25 +70,27 @@ isa = PBXGroup; children = ( 05AD2A1C24076E2D0051AC59 /* AdLibController.swift */, - 05AD2A1824076A880051AC59 /* StorySelector.swift */, ); path = "Model Controller"; sourceTree = ""; }; - 05AD2A14240767130051AC59 /* View Controller */ = { + 05AD2A14240767130051AC59 /* View Controllers */ = { isa = PBXGroup; children = ( 05AD2A16240767E30051AC59 /* AdLibCreatorViewController.swift */, + 38AF8E892406FCC400608D01 /* WackyAdLibsViewController.swift */, + 38AF8EAC240AF22000608D01 /* InformationViewController.swift */, 05AD2A1E24077BD80051AC59 /* StoryViewController.swift */, + 38AF8E9924070B6200608D01 /* SettingsViewController.swift */, + 0566EDE62411FBDF007EEBBC /* StoryTableViewController.swift */, ); - path = "View Controller"; + path = "View Controllers"; sourceTree = ""; }; 05AD2A15240767160051AC59 /* Views */ = { isa = PBXGroup; children = ( - 05AD2A1824076A880051AC59 /* StoryMode.swift */, - 38AF8EA624086A2400608D01 /* AdLibBookCollectionViewCell.swift */, + 0566EDE42411FBC7007EEBBC /* StoryTableViewCell.swift */, ); path = Views; sourceTree = ""; @@ -96,6 +99,8 @@ isa = PBXGroup; children = ( 38AF8E842406FCC400608D01 /* AdLibs */, + 38AF8E932406FCC600608D01 /* Info.plist */, + 38DA3DB4240E167D00236F1D /* Resources */, 38AF8E832406FCC400608D01 /* Products */, ); sourceTree = ""; @@ -111,19 +116,12 @@ 38AF8E842406FCC400608D01 /* AdLibs */ = { isa = PBXGroup; children = ( + 05AD2A122407670C0051AC59 /* Model */, 05AD2A15240767160051AC59 /* Views */, - 05AD2A14240767130051AC59 /* View Controller */, + 05AD2A14240767130051AC59 /* View Controllers */, 05AD2A13240767100051AC59 /* Model Controller */, - 05AD2A122407670C0051AC59 /* Model */, - 38AF8E852406FCC400608D01 /* AppDelegate.swift */, - 38AF8E872406FCC400608D01 /* SceneDelegate.swift */, - 38AF8E892406FCC400608D01 /* ViewController.swift */, - 38AF8E8B2406FCC400608D01 /* Main.storyboard */, - 38AF8E8E2406FCC600608D01 /* Assets.xcassets */, - 38AF8E902406FCC600608D01 /* LaunchScreen.storyboard */, - 38AF8E932406FCC600608D01 /* Info.plist */, + 38DA3DB2240E153F00236F1D /* Storyboard */, 38AF8EA12407105300608D01 /* Settings */, - 38AF8EA424086A0800608D01 /* AdLibBookCollectionViewController.swift */, ); path = AdLibs; sourceTree = ""; @@ -131,13 +129,30 @@ 38AF8EA12407105300608D01 /* Settings */ = { isa = PBXGroup; children = ( - 38AF8E9924070B6200608D01 /* SettingsViewController.swift */, - 38AF8E9B24070F6100608D01 /* String+UserDefaults.swift */, - 38AF8E9F24070FAF00608D01 /* ThemeHelper.swift */, + 38FC6BAE240B3CCF007DFE79 /* Settings.swift */, ); path = Settings; sourceTree = ""; }; + 38DA3DB2240E153F00236F1D /* Storyboard */ = { + isa = PBXGroup; + children = ( + 38AF8E8B2406FCC400608D01 /* Main.storyboard */, + ); + path = Storyboard; + sourceTree = ""; + }; + 38DA3DB4240E167D00236F1D /* Resources */ = { + isa = PBXGroup; + children = ( + 38AF8E852406FCC400608D01 /* AppDelegate.swift */, + 38AF8E872406FCC400608D01 /* SceneDelegate.swift */, + 38AF8E8E2406FCC600608D01 /* Assets.xcassets */, + 38AF8E902406FCC600608D01 /* LaunchScreen.storyboard */, + ); + path = Resources; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -209,19 +224,19 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 05AD2A1924076A880051AC59 /* StorySelector.swift in Sources */, - 05AD2A1B24076E0C0051AC59 /* AdLib.swift in Sources */, - 38AF8E8A2406FCC400608D01 /* ViewController.swift in Sources */, + 0566EDE72411FBDF007EEBBC /* StoryTableViewController.swift in Sources */, + 38AF8E8A2406FCC400608D01 /* WackyAdLibsViewController.swift in Sources */, 38AF8E862406FCC400608D01 /* AppDelegate.swift in Sources */, 05AD2A1D24076E2D0051AC59 /* AdLibController.swift in Sources */, 05AD2A17240767E30051AC59 /* AdLibCreatorViewController.swift in Sources */, + 381C8538240F98460056DF8A /* Story.swift in Sources */, + 0566EDE52411FBC7007EEBBC /* StoryTableViewCell.swift in Sources */, 38AF8E882406FCC400608D01 /* SceneDelegate.swift in Sources */, - 38AF8EA024070FAF00608D01 /* ThemeHelper.swift in Sources */, - 38AF8EA524086A0800608D01 /* AdLibBookCollectionViewController.swift in Sources */, 05AD2A1F24077BD80051AC59 /* StoryViewController.swift in Sources */, - 38AF8EA724086A2400608D01 /* AdLibBookCollectionViewCell.swift in Sources */, + 381C8536240F687A0056DF8A /* Words.swift in Sources */, + 38FC6BAF240B3CCF007DFE79 /* Settings.swift in Sources */, + 38AF8EAD240AF22000608D01 /* InformationViewController.swift in Sources */, 38AF8E9A24070B6200608D01 /* SettingsViewController.swift in Sources */, - 38AF8E9C24070F6100608D01 /* String+UserDefaults.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/AdLibs/AdLibs/AdLibBookCollectionViewController.swift b/AdLibs/AdLibs/AdLibBookCollectionViewController.swift deleted file mode 100644 index 561b34f..0000000 --- a/AdLibs/AdLibs/AdLibBookCollectionViewController.swift +++ /dev/null @@ -1,90 +0,0 @@ -// -// AdLibBookCollectionViewController.swift -// AdLibs -// -// Created by David Williams on 2/27/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import UIKit - -private let reuseIdentifier = "Cell" - -class AdLibBookCollectionViewController: UICollectionViewController { - - var adLib: AdLib? - var adlibController = AdLibController() - var storyViewController = StoryViewController() - override func viewDidLoad() { - super.viewDidLoad() - - self.collectionView!.register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier) - - // Do any additional setup after loading the view. - } - - - // 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?) { - if segue.identifier == "showAdlibSegue" { - guard let showStoryVC = segue.destination as? StoryViewController else { return } - showStoryVC.adLibController = adlibController - } - } - - - // MARK: UICollectionViewDataSource - - override func numberOfSections(in collectionView: UICollectionView) -> Int { - // #warning Incomplete implementation, return the number of sections - return 0 - } - - - override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - // #warning Incomplete implementation, return the number of items - return adlibController.adLibs.count - } - - override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) - - // Configure the cell - - return cell - } - - // MARK: UICollectionViewDelegate - - /* - // Uncomment this method to specify if the specified item should be highlighted during tracking - override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool { - return true - } - */ - - /* - // Uncomment this method to specify if the specified item should be selected - override func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { - return true - } - */ - - /* - // Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item - override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool { - return false - } - - override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool { - return false - } - - override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) { - - } - */ - -} diff --git a/AdLibs/AdLibs/Assets.xcassets/adlibslaunch.imageset/adlibslaunch.png b/AdLibs/AdLibs/Assets.xcassets/adlibslaunch.imageset/adlibslaunch.png deleted file mode 100644 index 695dbc6..0000000 Binary files a/AdLibs/AdLibs/Assets.xcassets/adlibslaunch.imageset/adlibslaunch.png and /dev/null differ diff --git a/AdLibs/AdLibs/Model Controller/AdLibController.swift b/AdLibs/AdLibs/Model Controller/AdLibController.swift index 8f9b989..a7ff0aa 100644 --- a/AdLibs/AdLibs/Model Controller/AdLibController.swift +++ b/AdLibs/AdLibs/Model Controller/AdLibController.swift @@ -9,73 +9,91 @@ import Foundation class AdLibController { - //stars can only be set by star controller - private(set) var adLibs: [AdLib] = [] + + var storyList: [Story] = [] + + init() { + loadFromPersistentStore() + } private var persistentFileURL: URL? { // Singleton = single instance that can be used throughout the app let fileManager = FileManager.default guard let documents = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first else { return nil } - // /Users/MJ/Documents - // /Users/MJ/Documents/adLibs.plist return documents.appendingPathComponent("adLibs.plist") - } - init() { - loadFromPersistentStore() - } - @discardableResult func createAdLib(title: String, noun: String, pronoun: String, verb: String, adjective: String, adverb: String, color: String) -> AdLib { - - let adLib = AdLib(title: title, noun: noun, pronoun: pronoun, verb: verb, adjective: adjective, adverb: adverb, color: color) - adLibs.append(adLib) - saveToPersistentStore() - return adLib - } - - func list() -> String { - var output = "" - for adlib in adLibs { - output += "\(adlib.title) " - } - return output - } - + + //Save and Load methods func saveToPersistentStore() { guard let url = persistentFileURL else { return } - //we need to convert the data in the file into nits of data that can be encoded - //in order to do this we need to ensure the model is encodable - //now we need to encode into data for plist do { let encoder = PropertyListEncoder()//we need a plist encoder = property list - let data = try encoder.encode(adLibs) //this is how we actually encode our model object + let data = try encoder.encode(storyList) //this is how we actually encode our model object try data.write(to: url) //now write it to the url we recently created. the url is the adLibs.plist that we created } catch { print("Error saving the adLibs data: \(error)") } } - + func loadFromPersistentStore() { let fileManager = FileManager.default guard let url = persistentFileURL, fileManager.fileExists(atPath: url.path) else { return } - do { let data = try Data(contentsOf: url) let decoder = PropertyListDecoder() - adLibs = try decoder.decode([AdLib].self, from: data) + storyList = try decoder.decode([Story].self, from: data) } catch { - print("Error loading adLibs data: \(error)") + print("Error loading storyList data: \(error)") } } - func updateStory(adLib: AdLib, newStory: String) { - guard let index = adLibs.firstIndex(of: adLib) else { return } - var updateAdLib = adLib - updateAdLib.title = newStory - adLibs.remove(at: index) - adLibs.insert(updateAdLib, at: index) - saveToPersistentStore() - } + @discardableResult func createStory(title: String, body: String) -> Story { + let storysaved = Story(body: body, title: title) + storyList.append(storysaved) + saveToPersistentStore() + return storysaved + } + + func updateStory(newTitle: String, newBody: String, oldStory: Story) { + guard let index = storyList.firstIndex(of: oldStory) else { return } + let updatedStory = Story(body: newBody, title: newTitle) + storyList.remove(at: index) + storyList.insert(updatedStory, at: index) + saveToPersistentStore() + } + + func deleteStory(which story: Story) { + guard let index = storyList.firstIndex(of: story) else { return } + storyList.remove(at: index) + saveToPersistentStore() + } + + var sortStories: [Story] { + let sortedStories = storyList.sorted(by: { $0.title.lowercased() < $1.title.lowercased() }) + return sortedStories + } + + var noun = ["caveman", "sheriff", "rock", "tree", "ocean", "table", "elf", "dog", "chair", "couch", "fork", "remote", "speaker", "quarry", "bark", "laptop", "phone", "button", "hotel"] + var pronoun = ["me", "you", "I", "she", "it", "this", "we", "they"] + var verb = ["run", "walk", "fly", "throw", "jump", "build", "see", "cut", "slap", "drill", "type"] + var adverb = ["abruptly", "beautifully", "carefully", "correctly", "quietly", "quickly", "eagerly", "speedily", "smoothly", "hungrily", "willfully"] + var adjective = ["good", "drab", "blasé", "different", "eary", "little", "small", "skinny", "heavy", "prickly", "dusty", "bumpy"] + var color = ["red", "blue", "orange", "yellow", "mauve", "tan", "violet", "turquoise", "grey"] + var vowels = ["A", "a","E", "e", "I", "i", "O", "o", "U", "u"] + + func getWords() -> Words { + let randomNoun = noun.randomElement() + let randomVerb = verb.randomElement() + let randomAdverb = adverb.randomElement() + let randomPronoun = pronoun.randomElement() + let randomAdjective = adjective.randomElement() + let randomColor = color.randomElement() + + let randomWords = Words(noun: randomNoun!, pronoun: randomPronoun!, verb: randomVerb!, adjective: randomAdjective!, adverb: randomAdverb!, color: randomColor!) + + return randomWords + } } diff --git a/AdLibs/AdLibs/Model Controller/StorySelector.swift b/AdLibs/AdLibs/Model Controller/StorySelector.swift deleted file mode 100644 index 966556b..0000000 --- a/AdLibs/AdLibs/Model Controller/StorySelector.swift +++ /dev/null @@ -1,56 +0,0 @@ -// -// StorySelector.swift -// AdLibs -// -// Created by Marc Jacques on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import Foundation - -enum Story { - case story1 - case story2 - case story3 -} - -class StorySelector { - - var story: Story - var adLib: AdLib? - - - var noun: String - var verb: String - var adjective: String - var adverb: String - var pronounPlace: String - var colorPlace: String - - - var story1 = "Allison takes her two \(noun)s for \(indefiniteArticleCheck(whichWord: verbPlace!)) around the \(noun). They are large \(noun)s. She is a petite girl. She is thrown about but still manages to keep them under control.\nShe sees her friend Billy across the street, \(verb)ing his three \(noun)s. They are not large like hers. They are \(adjective) but they have loud \(noun)s.\nThey pass each other and wave hello and go on their separate ways." - var story2 = "You find yourself suddenly in the middle of an orchard of lemon trees. \"Lemon trees?\" you ask yourself. \"What am I doing here?\" It doesn’t matter. You are here. Let’s deal with it.\nThe smell of lemons permeates the air. You are tempted to walk over to the nearest tree and pick a lemon. And walk over you do. You reach for a lemon on a low hanging branch. You are pricked by a thorn. Lesson learned. If you want a lemon, it’s safer from the grocer." - var story3 = "My house is not a large house. Neither is it a small house. My house is a comfortable house to me to live in. My house is blue with turquoise trim and is only a single story house.\nI have a fairly large backyard to play in and it is right behind a creek. I lose many balls into the creek and have to go and find them. My dog tries to help me do so. He does not help very well. He gets distracted by noises and I have to find him more often than my balls." - - init() { - if story == nil { - story = story1 - } - } - - - func storySelector(story: Story) -> AdLib { - guard adLib = adLib else { return } - - switch story { - case .story1: - adLib?.story = story1 - case .story2: - adLib?.story = story2 - case .story3: - adLib?.story = story3 - } - return adLib - } -} - diff --git a/AdLibs/AdLibs/Model/Story.swift b/AdLibs/AdLibs/Model/Story.swift new file mode 100644 index 0000000..9293b68 --- /dev/null +++ b/AdLibs/AdLibs/Model/Story.swift @@ -0,0 +1,32 @@ +// +// Story.swift +// AdLibs +// +// Created by David Williams on 3/4/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import Foundation + +enum StoryState { + case newStory + case updateStory +} + +enum StoryTemplate: String { + case story1 = "story1" + case story2 = "story2" + case story3 = "story3" + case random = "random" +} + +struct Story: Codable, Equatable { + + var body: String = "" + var title: String = "" + + init(body: String, title: String = "") { + self.body = body + self.title = title + } +} diff --git a/AdLibs/AdLibs/Model/AdLib.swift b/AdLibs/AdLibs/Model/Words.swift similarity index 55% rename from AdLibs/AdLibs/Model/AdLib.swift rename to AdLibs/AdLibs/Model/Words.swift index dc9a20e..aee17b2 100644 --- a/AdLibs/AdLibs/Model/AdLib.swift +++ b/AdLibs/AdLibs/Model/Words.swift @@ -1,31 +1,27 @@ // -// AdLib.swift +// Words.swift // AdLibs // -// Created by Marc Jacques on 2/26/20. +// Created by David Williams on 3/3/20. // Copyright © 2020 david williams. All rights reserved. // import Foundation -struct AdLib: Codable, Equatable { - var title: String +struct Words { var noun: String var pronoun: String var verb: String var adjective: String var adverb: String var color: String - var story: String - init(title: String, noun: String, pronoun: String, verb: String, adjective: String, adverb: String, color: String, story: String = " ") { - self.title = title + init(noun: String, pronoun: String, verb: String, adjective: String, adverb: String, color: String) { self.noun = noun self.pronoun = pronoun self.verb = verb self.adjective = adjective self.adverb = adverb self.color = color - self.story = story } } diff --git a/AdLibs/AdLibs/Settings/Settings.swift b/AdLibs/AdLibs/Settings/Settings.swift new file mode 100644 index 0000000..674d9f9 --- /dev/null +++ b/AdLibs/AdLibs/Settings/Settings.swift @@ -0,0 +1,19 @@ +// +// Settings.swift +// AdLibs +// +// Created by David Williams on 2/29/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import Foundation +import UIKit + +class Settings { + static let shared = Settings() + var story: StoryTemplate = .random + var storyChanged: Bool = false + var changeBackground = UserDefaults.standard.integer(forKey: "themeSet") + var randomYes: Bool = false +} + diff --git a/AdLibs/AdLibs/Settings/SettingsViewController.swift b/AdLibs/AdLibs/Settings/SettingsViewController.swift deleted file mode 100644 index 4d545bb..0000000 --- a/AdLibs/AdLibs/Settings/SettingsViewController.swift +++ /dev/null @@ -1,111 +0,0 @@ -// -// SettingsViewController.swift -// AdLibs -// -// Created by David Williams on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import UIKit - -protocol ThemeSelectedDelegate { - func themeChosen() -} -class SettingsViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { - var themeHelper = ThemeHelper() - var pickerData = ["Blue", "Dark", "Green", "Purple", "Teal"] - - @IBOutlet weak var themePicker: UIPickerView! - @IBOutlet weak var imageView1: UIImageView! - @IBOutlet weak var imageView2: UIImageView! - @IBOutlet weak var imageView3: UIImageView! - @IBOutlet weak var storyLabel1: UILabel! - @IBOutlet weak var storyLabel2: UILabel! - @IBOutlet weak var storyLabel3: UILabel! - - var themeDelegate: ThemeSelectedDelegate? - - override func viewDidLoad() { - super.viewDidLoad() - themePicker.delegate = self - updateViews() - } - - func numberOfComponents(in pickerView: UIPickerView) -> Int { - 1 - } - - func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { - pickerData.count - } - - func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { - return pickerData[row] - } - - func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { - let themePicked = pickerData[themePicker.selectedRow(inComponent: 0)] - switch themePicked { - case "Blue": - themeHelper.setThemePreferenceToBlue() - case "Dark": - themeHelper.setThemePreferenceToDark() - case "Green": - themeHelper.setThemePreferenceToGreen() - case "Purple": - themeHelper.setThemePreferenceToPurple() - case "Teal": - themeHelper.setThemePreferenceToTeal() - default: - break - } - choseTheme() - } - - func choseTheme() { - themeDelegate?.themeChosen() - } - - func setTheme() { - guard let theme = themeHelper.themePreference else { return } - switch theme { - case "Blue": - view.backgroundColor = .blue - case "Dark": - view.backgroundColor = .darkGray - case "Green": - view.backgroundColor = .systemGreen - case "Purple": - view.backgroundColor = .systemPurple - case "Teal": - view.backgroundColor = .systemTeal - default: - break - } - } - - func updateViews() { - setTheme() - } - - /* - // 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. - } - */ - - @IBAction func story1Switch(_ sender: Any) { - } - @IBAction func story2Switch(_ sender: Any) { - } - @IBAction func story3Switch(_ sender: Any) { - } - - @IBAction func selectSettingsButtonTapped(_ sender: Any) { - } - -} diff --git a/AdLibs/AdLibs/Settings/String+UserDefaults.swift b/AdLibs/AdLibs/Settings/String+UserDefaults.swift deleted file mode 100644 index 39df1ae..0000000 --- a/AdLibs/AdLibs/Settings/String+UserDefaults.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// String+UserDefaults.swift -// AdLibs -// -// Created by David Williams on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import Foundation - -extension String { - static var themePreferenceKey = "" -} diff --git a/AdLibs/AdLibs/Settings/ThemeHelper.swift b/AdLibs/AdLibs/Settings/ThemeHelper.swift deleted file mode 100644 index 6b53f03..0000000 --- a/AdLibs/AdLibs/Settings/ThemeHelper.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// ThemeHelper.swift -// AdLibs -// -// Created by David Williams on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import Foundation - -class ThemeHelper { - - init() { - if themePreference == nil { - setThemePreferenceToDark() - } - } - - func setThemePreferenceToBlue() { - UserDefaults.standard.set("Blue", forKey: .themePreferenceKey) - } - - func setThemePreferenceToDark() { - UserDefaults.standard.set("Dark", forKey: .themePreferenceKey) - } - - func setThemePreferenceToGreen() { - UserDefaults.standard.set("Green", forKey: .themePreferenceKey) - } - - func setThemePreferenceToPurple() { - UserDefaults.standard.set("Purple", forKey: .themePreferenceKey) - } - - func setThemePreferenceToTeal() { - UserDefaults.standard.set("Teal", forKey: .themePreferenceKey) - } - - var themePreference: String? { - let theme = UserDefaults.standard.string(forKey: .themePreferenceKey) - return theme - } -} diff --git a/AdLibs/AdLibs/Base.lproj/Main.storyboard b/AdLibs/AdLibs/Storyboard/Base.lproj/Main.storyboard similarity index 63% rename from AdLibs/AdLibs/Base.lproj/Main.storyboard rename to AdLibs/AdLibs/Storyboard/Base.lproj/Main.storyboard index 131404b..e256e52 100644 --- a/AdLibs/AdLibs/Base.lproj/Main.storyboard +++ b/AdLibs/AdLibs/Storyboard/Base.lproj/Main.storyboard @@ -4,75 +4,66 @@ - - + - + - - - - - - - - - - + + + + + + + + - - - - - - - + - - - + - + @@ -83,67 +74,42 @@ - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + + - - + + + - - - + + - - + + + - - + + - - @@ -377,18 +341,18 @@ - - - - - - - + + + + + + + @@ -399,16 +363,16 @@ - + - + - + @@ -421,55 +385,67 @@ + - + + + + - - + + - - + + - - - - - - - - - - - - + + + + + + - + + + + + + + + + - + + - - + + - - + + - - - - + + + + - + @@ -507,15 +483,37 @@ + + + + + + + + + + + + + + + + + + + + + + - - - + + + diff --git a/AdLibs/AdLibs/View Controller/AdLibCreatorViewController.swift b/AdLibs/AdLibs/View Controller/AdLibCreatorViewController.swift deleted file mode 100644 index b923193..0000000 --- a/AdLibs/AdLibs/View Controller/AdLibCreatorViewController.swift +++ /dev/null @@ -1,71 +0,0 @@ -// -// AdLibCreatorViewController.swift -// AdLibs -// -// Created by Marc Jacques on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import UIKit - -class AdLibCreatorViewController: UIViewController { - - // MARK: - Properties and Outlets - - @IBOutlet weak var titleTextField: UITextField! - @IBOutlet weak var nounTextField: UITextField! - @IBOutlet weak var verbTextField: UITextField! - @IBOutlet weak var pronounTextField: UITextField! - @IBOutlet weak var adjectiveTextField: UITextField! - @IBOutlet weak var adverbTextField: UITextField! - @IBOutlet weak var colorTextView: UITextField! - - var adLibController: AdLibController? - var themeHelper: ThemeHelper? - var adLib: AdLib? - var storyMode: Story? - - var toStoryView = "SegueToStoryView" - override func viewDidLoad() { - super.viewDidLoad() - - - // Do any additional setup after loading the view. - } - - @IBAction func showStoryTapped(_ sender: UIButton) { - guard let title = titleTextField.text, - let noun = nounTextField.text, - let verb = verbTextField.text, - let pronoun = pronounTextField.text, - let adjective = adjectiveTextField.text, - let adverb = adverbTextField.text, - let color = colorTextView.text, - !title.isEmpty, - !noun.isEmpty, - !verb.isEmpty, - !pronoun.isEmpty, - !adjective.isEmpty, - !adverb.isEmpty, - !color.isEmpty else { return } - - guard let adLibController = adLibController else { return } - adLibController.createAdLib(title: title, noun: noun, pronoun: pronoun, verb: verb, adjective: adjective, adverb: adverb, color: color) - } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - guard let adLibController = adLibController else { return } - if segue.identifier == toStoryView { - guard let destination = segue.destination as? StoryViewController else { return } - destination.adLibController = adLibController - destination.adLib = adLib - destination.storyMode = storyMode - destination.themeHelper = themeHelper - - } - } - - - - -} diff --git a/AdLibs/AdLibs/View Controller/StoryViewController.swift b/AdLibs/AdLibs/View Controller/StoryViewController.swift deleted file mode 100644 index dc8fd4e..0000000 --- a/AdLibs/AdLibs/View Controller/StoryViewController.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// StoryViewController.swift -// AdLibs -// -// Created by Marc Jacques on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import UIKit - -class StoryViewController: UIViewController { -// MARK: - Properties and Outlets - - var adLibController : AdLibController? - var adLib: AdLib? - var storyMode: Story? - var themeHelper: ThemeHelper? - var story = String() - - @IBOutlet weak var titleLabel: UILabel! - @IBOutlet weak var storyTextVew: UITextView! - - override func viewDidLoad() { - super.viewDidLoad() - - - } - - @IBAction func saveButtonTapped(_ sender: UIButton) { - guard let adLibController = adLibController, - let adLib = adLib else { return } - adLibController.updateStory(adLib: adLib, newStory: story) - } - - - -} diff --git a/AdLibs/AdLibs/View Controllers/AdLibCreatorViewController.swift b/AdLibs/AdLibs/View Controllers/AdLibCreatorViewController.swift new file mode 100644 index 0000000..c078c40 --- /dev/null +++ b/AdLibs/AdLibs/View Controllers/AdLibCreatorViewController.swift @@ -0,0 +1,193 @@ +// +// AdLibCreatorViewController.swift +// AdLibs +// +// Created by Marc Jacques on 2/26/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + + +class AdLibCreatorViewController: UIViewController { + + // MARK: - Properties and Outlets + + @IBOutlet weak var nounTextField: UITextField! + @IBOutlet weak var verbTextField: UITextField! + @IBOutlet weak var pronounTextField: UITextField! + @IBOutlet weak var adjectiveTextField: UITextField! + @IBOutlet weak var adverbTextField: UITextField! + @IBOutlet weak var colorTextField: UITextField! + @IBOutlet weak var switchLabel: UISwitch! + @IBOutlet weak var randomAdlibLabel: UILabel! + + var adLibController: AdLibController? + + var words: Words? + var story: Story? + var storySelected = "" + var storyState: StoryState = .newStory + var randomWords: Words? + + override func viewDidLoad() { + super.viewDidLoad() + + nounTextField.backgroundColor = UIColor(white: 1, alpha: 0.75) + verbTextField.backgroundColor = UIColor(white: 1, alpha: 0.75) + pronounTextField.backgroundColor = UIColor(white: 1, alpha: 0.75) + adjectiveTextField.backgroundColor = UIColor(white: 1, alpha: 0.75) + adverbTextField.backgroundColor = UIColor(white: 1, alpha: 0.75) + colorTextField.backgroundColor = UIColor(white: 1, alpha: 0.75) + + [nounTextField, verbTextField, pronounTextField, adjectiveTextField, adverbTextField, colorTextField].forEach { $0.delegate = self} + updateViews() + } + + func updateViews() { + Settings.shared.randomYes = false + setTheme() + } + + func storySelector(adLib: Words) -> String { + + let story1 = " Allison takes her two \(adLib.noun)s for a \(adLib.verb) around the block. They are large \(adLib.noun)s. She is a petite girl. She is thrown about but still manages to keep them under control.\n She sees her friend Billy across the street, \(adLib.verb)ing his three \(adLib.noun)s. They are not large like hers. They are \(adLib.adjective) but they have loud barks.\n They \(adLib.adverb) pass each other and wave hello and go on their separate ways." + let story2 = " You find yourself suddenly in the middle of an orchard of lemon \(adLib.noun)s. \"Lemon \(adLib.noun)s?\" you ask yourself. \"What am I doing here?\" It doesn’t matter. You are here. Let’s \(adLib.verb) with it.\n The \(adLib.adjective) of lemons permeates the air. You are tempted to walk over to the nearest tree and pick a lemon. And walk over \(adLib.pronoun) do. You reach for a big, \(adLib.color) lemon on a low hanging branch. You are pricked by a thorn. Lesson learned. If you want a lemon, it’s safer from the grocer." + let story3 = " I am still \(adLib.verb)ing how to code in Swift. A programming \(adLib.noun) used in iOS and tvOS apps by Apple. There is a lot to learn and understand. Even though it is suppose to be an \(adLib.adjective) language to \(adLib.verb) it can be daunting, but satisfying. There are times when \(adLib.verb)ing to code you can see \(adLib.color) in frustration.\n To see your results come alive even on a simulator after a challenging process of \(adLib.adverb) working through a problem can be very exciting. The possibilities are far reaching and within \(adLib.pronoun) grasp!" + + let storiesArray = [story1, story2, story3] + let randomStory = storiesArray[Int.random(in: 0...2)] + + switch Settings.shared.story { + case .story1: + storySelected = story1 + case .story2: + storySelected = story2 + case .story3: + storySelected = story3 + case .random: + storySelected = randomStory + } + return storySelected + } + + private func setBody() { + if Settings.shared.randomYes { + guard let randomWords = randomWords else { return } + let storyString = storySelector(adLib: randomWords) + let storyBody = Story(body: storyString) + self.story = storyBody + } else { + guard let noun = nounTextField.text, + let verb = verbTextField.text, + let pronoun = pronounTextField.text, + let adjective = adjectiveTextField.text, + let adverb = adverbTextField.text, + let color = colorTextField.text, + !noun.isEmpty, + !verb.isEmpty, + !pronoun.isEmpty, + !adjective.isEmpty, + !adverb.isEmpty, + !color.isEmpty else { return alert() } + words = Words(noun: noun, pronoun: pronoun, verb: verb, adjective: adjective, adverb: adverb, color: color) + guard let words = words else { return } + + let storyString = storySelector(adLib: words) + let storyBody = Story(body: storyString) + self.story = storyBody + } + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "SegueToStoryView" { + let destination = segue.destination as! StoryViewController + setBody() + destination.adLibController = adLibController + destination.storyState = storyState + destination.storyFound = self.story + } + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + view.backgroundColor = .blue + case 1: + view.backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + view.backgroundColor = .darkGray + case 3: + view.backgroundColor = .systemGray3 + case 4: + view.backgroundColor = .systemGreen + case 5: + view.backgroundColor = .lightGray + case 6: + view.backgroundColor = .systemOrange + case 7: + view.backgroundColor = .systemPurple + case 8: + view.backgroundColor = .systemTeal + case 9: + view.backgroundColor = .yellow + default: + break + } + } + + @IBAction func gameSelectSwitched(_ sender: UISwitch) { + Settings.shared.randomYes.toggle() + + if Settings.shared.randomYes { + [nounTextField, verbTextField, pronounTextField, adjectiveTextField, adverbTextField, colorTextField].forEach { $0?.isEnabled = false} + randomWords = adLibController?.getWords() + nounTextField.text = randomWords?.noun + verbTextField.text = randomWords?.verb + pronounTextField.text = randomWords?.pronoun + adjectiveTextField.text = randomWords?.adjective + adverbTextField.text = randomWords?.adverb + colorTextField.text = randomWords?.color + } else { + nounTextField.text = "" + verbTextField.text = "" + pronounTextField.text = "" + adjectiveTextField.text = "" + adverbTextField.text = "" + colorTextField.text = "" + [nounTextField, verbTextField, pronounTextField, adjectiveTextField, adverbTextField, colorTextField].forEach { $0?.isEnabled = true} + } + } + + func alert() { + let alert = UIAlertController(title: "No Ad-Lib to Pass!", message: "Please Enter words into text fields", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) + present(alert, animated: true, completion: nil) + } +} + +extension AdLibCreatorViewController: UITextFieldDelegate { + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + guard let text = textField.text, + !text.isEmpty else { return false } + switch textField { + case nounTextField: + verbTextField.becomeFirstResponder() + case verbTextField: + pronounTextField.becomeFirstResponder() + case pronounTextField: + adjectiveTextField.becomeFirstResponder() + case adjectiveTextField: + adverbTextField.becomeFirstResponder() + case adverbTextField: + colorTextField.becomeFirstResponder() + default: + colorTextField.resignFirstResponder() + } + return true + } +} + + + + diff --git a/AdLibs/AdLibs/View Controllers/InformationViewController.swift b/AdLibs/AdLibs/View Controllers/InformationViewController.swift new file mode 100644 index 0000000..3a557df --- /dev/null +++ b/AdLibs/AdLibs/View Controllers/InformationViewController.swift @@ -0,0 +1,56 @@ +// +// InformationViewController.swift +// AdLibs +// +// Created by David Williams on 2/29/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + +class InformationViewController: UIViewController { + + @IBOutlet weak var infoTextView: UITextView! + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + infoTextView.backgroundColor = UIColor(white: 1, alpha: 0.65) + updateViews() + } + + override func viewWillAppear(_ animated: Bool) { + setTheme() + } + + func updateViews() { + infoTextView.text = "\n\n\n\nHello and hey there!\n\nThis is an ad-libs app where you can enter words to be inserted into normal conversaational phrases and then get a funny and quirky result!\n\n\nThere are two modes of play: a user selectable mode, giving you control of which ad-lib story to use, and a random mode where an ad-lib story and words are chosen for you.\n\nYou can go to the Settings section and change the color theme and pick a story to use. If you do not pick a story, one will be chosen for you.\n\n\n\n\nAfter playing Wacky Ad-Libs you can choose to set a title for the ad-lib and save it the Ad-Lib Book to be viewed at a later time!\n\n\n\n\nEnjoy!" + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + view.backgroundColor = .blue + case 1: + view.backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + view.backgroundColor = .darkGray + case 3: + view.backgroundColor = .systemGray3 + case 4: + view.backgroundColor = .systemGreen + case 5: + view.backgroundColor = .lightGray + case 6: + view.backgroundColor = .systemOrange + case 7: + view.backgroundColor = .systemPurple + case 8: + view.backgroundColor = .systemTeal + case 9: + view.backgroundColor = .yellow + default: + break + } + } +} diff --git a/AdLibs/AdLibs/View Controllers/SettingsViewController.swift b/AdLibs/AdLibs/View Controllers/SettingsViewController.swift new file mode 100644 index 0000000..933cecd --- /dev/null +++ b/AdLibs/AdLibs/View Controllers/SettingsViewController.swift @@ -0,0 +1,137 @@ +// +// SettingsViewController.swift +// AdLibs +// +// Created by David Williams on 2/26/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + +protocol ThemeSelectedDelegate { + func themeChosen() +} +class SettingsViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { + var pickerData = ["Blue", "Cyan", "Dark", "Gray", "Green","Light", "Orange", "Purple", "Teal", "Yellow"] + + @IBOutlet weak var themePicker: UIPickerView! + @IBOutlet weak var story1Button: UIButton! + @IBOutlet weak var story2Button: UIButton! + @IBOutlet weak var story3Button: UIButton! + + override func viewDidLoad() { + super.viewDidLoad() + themePicker.delegate = self + themePicker.selectRow(Settings.shared.changeBackground, inComponent: + 0, animated: true) + themePicker.backgroundColor = UIColor(white: 1, alpha: 0.35) + themePicker.layer.borderColor = UIColor.white.cgColor + themePicker.layer.borderWidth = 2.5 + themePicker.layer.cornerRadius = 7.5 + customizeButtons(sender: 0) + + updateViews() + } + + func customizeButtons(sender: Int) { + Settings.shared.storyChanged = true + switch sender { + case 0: + story1Button.layer.borderColor = UIColor.red.cgColor + story1Button.layer.borderWidth = 2.5 + story1Button.layer.cornerRadius = 8.0 + story1Button.backgroundColor = UIColor.init(red: 255/255, green: 0/255, blue: 0/255, alpha: 0.55) + story2Button.layer.borderColor = UIColor.clear.cgColor + story3Button.layer.borderColor = UIColor.clear.cgColor + story2Button.backgroundColor = .clear + story3Button.backgroundColor = .clear + Settings.shared.story = .story1 + case 1: + story2Button.layer.borderColor = UIColor.red.cgColor + story2Button.layer.borderWidth = 2.5 + story2Button.layer.cornerRadius = 8.0 + story2Button.backgroundColor = UIColor.init(red: 255/255, green: 0/255, blue: 0/255, alpha: 0.55) + story1Button.layer.borderColor = UIColor.clear.cgColor + story3Button.layer.borderColor = UIColor.clear.cgColor + story1Button.backgroundColor = .clear + story3Button.backgroundColor = .clear + Settings.shared.story = .story2 + case 2: + story3Button.layer.borderColor = UIColor.red.cgColor + story3Button.layer.borderWidth = 2.5 + story3Button.layer.cornerRadius = 8.0 + story3Button.backgroundColor = UIColor.init(red: 255/255, green: 0/255, blue: 0/255, alpha: 0.55) + story1Button.layer.borderColor = UIColor.clear.cgColor + story2Button.layer.borderColor = UIColor.clear.cgColor + story1Button.backgroundColor = .clear + story2Button.backgroundColor = .clear + Settings.shared.story = .story3 + + default: + break + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + setTheme() + } + + func numberOfComponents(in pickerView: UIPickerView) -> Int { + 1 + } + + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + pickerData.count + } + + func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { + return pickerData[row] + } + + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + Settings.shared.changeBackground = themePicker.selectedRow(inComponent: 0) + UserDefaults.standard.set(Settings.shared.changeBackground, forKey: "themeSet") + setTheme() + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + view.backgroundColor = .blue + case 1: + view.backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + view.backgroundColor = .darkGray + case 3: + view.backgroundColor = .systemGray3 + case 4: + view.backgroundColor = .systemGreen + case 5: + view.backgroundColor = .lightGray + case 6: + view.backgroundColor = .systemOrange + case 7: + view.backgroundColor = .systemPurple + case 8: + view.backgroundColor = .systemTeal + case 9: + view.backgroundColor = .yellow + default: + break + } + } + + func updateViews() { + setTheme() + } + + @IBAction func storySelectButtonPressed(_ sender: UIButton) { + + if Settings.shared.storyChanged { + customizeButtons(sender: sender.tag) + } else if !Settings.shared.storyChanged { + customizeButtons(sender: 0) + } + } +} diff --git a/AdLibs/AdLibs/View Controllers/StoryTableViewController.swift b/AdLibs/AdLibs/View Controllers/StoryTableViewController.swift new file mode 100644 index 0000000..35bdab8 --- /dev/null +++ b/AdLibs/AdLibs/View Controllers/StoryTableViewController.swift @@ -0,0 +1,102 @@ +// +// StoryTableViewController.swift +// AdLibs +// +// Created by Marc Jacques on 3/5/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + +class StoryTableViewController: UITableViewController { + // MARK: - Properties and Outlets + + var adLibController = AdLibController() + var storyState = StoryState.updateStory + + override func viewDidLoad() { + super.viewDidLoad() + setTheme() + tableView.reloadData() + } + + override func viewWillAppear(_ animated: Bool) { + tableView.reloadData() + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + view.backgroundColor = .blue + case 1: + view.backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + view.backgroundColor = .darkGray + case 3: + view.backgroundColor = .systemGray3 + case 4: + view.backgroundColor = .systemGreen + case 5: + view.backgroundColor = .lightGray + case 6: + view.backgroundColor = .systemOrange + case 7: + view.backgroundColor = .systemPurple + case 8: + view.backgroundColor = .systemTeal + case 9: + view.backgroundColor = .yellow + default: + break + } + } + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return adLibController.storyList.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: "storyCell", for: indexPath) as? StoryTableViewCell else { return UITableViewCell() } + let story = storiesFor(indexPath: indexPath) + cell.story = story + + return cell + } + + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + let story = storiesFor(indexPath: indexPath) + adLibController.deleteStory(which: story) + tableView.reloadData() + } + } + + // 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?) { + if segue.identifier == "EditStorySegue" { + guard let showStoryVC = segue.destination as? StoryViewController, + let indexPath = tableView.indexPathForSelectedRow else { return } + showStoryVC.adLibController = adLibController + let story = storiesFor(indexPath: indexPath) + showStoryVC.storyFound = story + showStoryVC.storyState = storyState + } + } + + private func storiesFor(indexPath: IndexPath) -> Story { + var story: Story? + story = adLibController.sortStories[indexPath.row] + return story! + } + +} diff --git a/AdLibs/AdLibs/View Controllers/StoryViewController.swift b/AdLibs/AdLibs/View Controllers/StoryViewController.swift new file mode 100644 index 0000000..1e4105a --- /dev/null +++ b/AdLibs/AdLibs/View Controllers/StoryViewController.swift @@ -0,0 +1,89 @@ +// +// StoryViewController.swift +// AdLibs +// +// Created by Marc Jacques on 2/26/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + +class StoryViewController: UIViewController { + // MARK: - Properties and Outlets + + var adLibController : AdLibController? + var storyFound: Story? + var storyState: StoryState? + + @IBOutlet weak var storyTitleField: UITextField! + @IBOutlet weak var storyTextVew: UITextView! + @IBOutlet weak var enterAdlibTitleLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + + storyTitleField.backgroundColor = UIColor(white: 1, alpha: 0.45) + storyTextVew.backgroundColor = UIColor(white: 1, alpha: 0.75) + updateViews() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + setTheme() + } + + func updateViews(){ + guard let storyFound = storyFound else { return } + if storyFound.title != "" { + enterAdlibTitleLabel.text = "Edit Your Ad-Lib Title" + storyTitleField.text = storyFound.title + storyTextVew.text = storyFound.body + } else { + enterAdlibTitleLabel.text = "Enter Your Ad-Lib Title" + storyTextVew.text = "\n\n\n\n\n" + storyFound.body + } + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + view.backgroundColor = .blue + case 1: + view.backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + view.backgroundColor = .darkGray + case 3: + view.backgroundColor = .systemGray3 + case 4: + view.backgroundColor = .systemGreen + case 5: + view.backgroundColor = .lightGray + case 6: + view.backgroundColor = .systemOrange + case 7: + view.backgroundColor = .systemPurple + case 8: + view.backgroundColor = .systemTeal + case 9: + view.backgroundColor = .yellow + default: + break + } + } + + @IBAction func saveButtonTapped(_ sender: Any) { + guard let storyState = storyState, + let storyFound = storyFound, + let title = storyTitleField.text, + let body = storyTextVew.text, + !title.isEmpty, + !body.isEmpty else { return } + if storyState == .newStory { + adLibController?.createStory(title: title, body: body) + navigationController?.popToRootViewController(animated: true) + } else { + adLibController?.updateStory(newTitle: title, newBody: body, oldStory: storyFound) + navigationController?.popViewController(animated: true) + } + } +} diff --git a/AdLibs/AdLibs/View Controllers/WackyAdLibsViewController.swift b/AdLibs/AdLibs/View Controllers/WackyAdLibsViewController.swift new file mode 100644 index 0000000..d5e1215 --- /dev/null +++ b/AdLibs/AdLibs/View Controllers/WackyAdLibsViewController.swift @@ -0,0 +1,64 @@ +// +// WackyAdLibsViewController.swift +// AdLibs +// +// Created by David Williams on 2/26/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + +class WackyAdLibsViewController: UIViewController { + +private let collectionViewIdentifier = "AdLibListCollectionSegue" + var adlibcontroller = AdLibController() + override func viewDidLoad() { + super.viewDidLoad() + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + setTheme() + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "StartAdLibSegue" { + let destination = segue.destination as! AdLibCreatorViewController + destination.adLibController = adlibcontroller + } + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + view.backgroundColor = .blue + case 1: + view.backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + view.backgroundColor = .darkGray + case 3: + view.backgroundColor = .systemGray3 + case 4: + view.backgroundColor = .systemGreen + case 5: + view.backgroundColor = .lightGray + case 6: + view.backgroundColor = .systemOrange + case 7: + view.backgroundColor = .systemPurple + case 8: + view.backgroundColor = .systemTeal + case 9: + view.backgroundColor = .yellow + default: + break + } + } +} + +extension WackyAdLibsViewController: ThemeSelectedDelegate { + func themeChosen() { + setTheme() + } +} diff --git a/AdLibs/AdLibs/ViewController.swift b/AdLibs/AdLibs/ViewController.swift deleted file mode 100644 index bcfb9cf..0000000 --- a/AdLibs/AdLibs/ViewController.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// ViewController.swift -// AdLibs -// -// Created by David Williams on 2/26/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import UIKit - -class ViewController: UIViewController { - - var themeHelper = ThemeHelper() - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view. - setTheme() - } - - func setTheme() { - let theme = themeHelper.themePreference - switch theme { - case "Blue": - view.backgroundColor = .blue - case "Dark": - view.backgroundColor = .darkGray - case "Green": - view.backgroundColor = .systemGreen - case "Purple": - view.backgroundColor = .systemPurple - case "Teal": - view.backgroundColor = .systemTeal - default: - break - } - } -} - -extension ViewController: ThemeSelectedDelegate { - func themeChosen() { - setTheme() - } -} diff --git a/AdLibs/AdLibs/Views/AdLibBookCollectionViewCell.swift b/AdLibs/AdLibs/Views/AdLibBookCollectionViewCell.swift deleted file mode 100644 index 7a89fe8..0000000 --- a/AdLibs/AdLibs/Views/AdLibBookCollectionViewCell.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// AdLibBookCollectionViewCell.swift -// AdLibs -// -// Created by David Williams on 2/27/20. -// Copyright © 2020 david williams. All rights reserved. -// - -import UIKit - -class AdLibBookCollectionViewCell: UICollectionViewCell { - -} diff --git a/AdLibs/AdLibs/Views/StoryTableViewCell.swift b/AdLibs/AdLibs/Views/StoryTableViewCell.swift new file mode 100644 index 0000000..30912b9 --- /dev/null +++ b/AdLibs/AdLibs/Views/StoryTableViewCell.swift @@ -0,0 +1,57 @@ +// +// StoryTableViewCell.swift +// AdLibs +// +// Created by Marc Jacques on 3/5/20. +// Copyright © 2020 david williams. All rights reserved. +// + +import UIKit + +class StoryTableViewCell: UITableViewCell { + + var adLibController = AdLibController() + + var story: Story? { + didSet { + updateViews() + setTheme() + } + } + + @IBOutlet weak var storyTitleLabel: UILabel! + + func updateViews() { + guard let story = story else { return } + storyTitleLabel.text = story.title + } + + func setTheme() { + switch Settings.shared.changeBackground { + case 0: + backgroundColor = .blue + case 1: + backgroundColor = UIColor(red: 129/255, green: 194/255, blue: 183/255, alpha: 1.0) + case 2: + backgroundColor = .darkGray + case 3: + backgroundColor = .systemGray3 + case 4: + backgroundColor = .systemGreen + case 5: + backgroundColor = .lightGray + case 6: + backgroundColor = .systemOrange + case 7: + backgroundColor = .systemPurple + case 8: + backgroundColor = .systemTeal + case 9: + backgroundColor = .yellow + default: + break + } + } +} + + diff --git a/AdLibs/AdLibs/AppDelegate.swift b/AdLibs/Resources/AppDelegate.swift similarity index 100% rename from AdLibs/AdLibs/AppDelegate.swift rename to AdLibs/Resources/AppDelegate.swift diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/1024.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/1024.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/1024.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/1024.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/120-1.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/120-1.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/120-1.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/120-1.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/120.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/120.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/120.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/120.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/152.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/152.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/152.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/152.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/167.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/167.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/167.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/167.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/180.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/180.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/180.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/180.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/20.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/20.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/20.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/20.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/29.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/29.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/29.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/29.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/40-1.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/40-1.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/40-1.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/40-1.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/40-2.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/40-2.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/40-2.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/40-2.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/40.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/40.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/40.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/40.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/58-1.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/58-1.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/58-1.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/58-1.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/58.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/58.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/58.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/58.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/60.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/60.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/60.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/60.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/76.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/76.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/76.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/76.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/80-1.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/80-1.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/80-1.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/80-1.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/80.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/80.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/80.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/80.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/87.png b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/87.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/87.png rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/87.png diff --git a/AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/Contents.json b/AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/AppIcon.appiconset/Contents.json rename to AdLibs/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/Contents.json b/AdLibs/Resources/Assets.xcassets/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/Contents.json rename to AdLibs/Resources/Assets.xcassets/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/adlibslaunch.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/adlibslaunch.imageset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/adlibslaunch.imageset/Contents.json rename to AdLibs/Resources/Assets.xcassets/adlibslaunch.imageset/Contents.json diff --git a/AdLibs/Resources/Assets.xcassets/adlibslaunch.imageset/adlibslaunch.png b/AdLibs/Resources/Assets.xcassets/adlibslaunch.imageset/adlibslaunch.png new file mode 100644 index 0000000..20e2f61 Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/adlibslaunch.imageset/adlibslaunch.png differ diff --git a/AdLibs/AdLibs/Assets.xcassets/checkmark.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/checkmark.imageset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/checkmark.imageset/Contents.json rename to AdLibs/Resources/Assets.xcassets/checkmark.imageset/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/checkmark.imageset/checkmark.png b/AdLibs/Resources/Assets.xcassets/checkmark.imageset/checkmark.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/checkmark.imageset/checkmark.png rename to AdLibs/Resources/Assets.xcassets/checkmark.imageset/checkmark.png diff --git a/AdLibs/AdLibs/Assets.xcassets/checkmark.png b/AdLibs/Resources/Assets.xcassets/checkmark.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/checkmark.png rename to AdLibs/Resources/Assets.xcassets/checkmark.png diff --git a/AdLibs/Resources/Assets.xcassets/game_controller.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/Contents.json new file mode 100644 index 0000000..de1a790 --- /dev/null +++ b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "game_controller.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "game_controller@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "game_controller@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller.png b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller.png new file mode 100644 index 0000000..df0891d Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller.png differ diff --git a/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller@2x.png b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller@2x.png new file mode 100644 index 0000000..336e170 Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller@2x.png differ diff --git a/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller@3x.png b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller@3x.png new file mode 100644 index 0000000..3b8ac92 Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/game_controller.imageset/game_controller@3x.png differ diff --git a/AdLibs/Resources/Assets.xcassets/home.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/home.imageset/Contents.json new file mode 100644 index 0000000..5a186dd --- /dev/null +++ b/AdLibs/Resources/Assets.xcassets/home.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "images.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "images@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "images@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/AdLibs/Resources/Assets.xcassets/home.imageset/images.png b/AdLibs/Resources/Assets.xcassets/home.imageset/images.png new file mode 100644 index 0000000..c91bd34 Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/home.imageset/images.png differ diff --git a/AdLibs/Resources/Assets.xcassets/home.imageset/images@2x.png b/AdLibs/Resources/Assets.xcassets/home.imageset/images@2x.png new file mode 100644 index 0000000..07039b6 Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/home.imageset/images@2x.png differ diff --git a/AdLibs/Resources/Assets.xcassets/home.imageset/images@3x.png b/AdLibs/Resources/Assets.xcassets/home.imageset/images@3x.png new file mode 100644 index 0000000..a321643 Binary files /dev/null and b/AdLibs/Resources/Assets.xcassets/home.imageset/images@3x.png differ diff --git a/AdLibs/AdLibs/Assets.xcassets/info.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/info.imageset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/info.imageset/Contents.json rename to AdLibs/Resources/Assets.xcassets/info.imageset/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/info.imageset/info.png b/AdLibs/Resources/Assets.xcassets/info.imageset/info.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/info.imageset/info.png rename to AdLibs/Resources/Assets.xcassets/info.imageset/info.png diff --git a/AdLibs/AdLibs/Assets.xcassets/info.imageset/info@2x.png b/AdLibs/Resources/Assets.xcassets/info.imageset/info@2x.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/info.imageset/info@2x.png rename to AdLibs/Resources/Assets.xcassets/info.imageset/info@2x.png diff --git a/AdLibs/AdLibs/Assets.xcassets/info.imageset/info@3x.png b/AdLibs/Resources/Assets.xcassets/info.imageset/info@3x.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/info.imageset/info@3x.png rename to AdLibs/Resources/Assets.xcassets/info.imageset/info@3x.png diff --git a/AdLibs/AdLibs/Assets.xcassets/questionMark.imageset/questionMark.png b/AdLibs/Resources/Assets.xcassets/questionMark.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/questionMark.imageset/questionMark.png rename to AdLibs/Resources/Assets.xcassets/questionMark.png diff --git a/AdLibs/AdLibs/Assets.xcassets/questionMark.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/questionmark.imageset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/questionMark.imageset/Contents.json rename to AdLibs/Resources/Assets.xcassets/questionmark.imageset/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/questionMark.png b/AdLibs/Resources/Assets.xcassets/questionmark.imageset/questionMark.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/questionMark.png rename to AdLibs/Resources/Assets.xcassets/questionmark.imageset/questionMark.png diff --git a/AdLibs/AdLibs/Assets.xcassets/settings.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/settings.imageset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/settings.imageset/Contents.json rename to AdLibs/Resources/Assets.xcassets/settings.imageset/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/settings.imageset/settings.png b/AdLibs/Resources/Assets.xcassets/settings.imageset/settings.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/settings.imageset/settings.png rename to AdLibs/Resources/Assets.xcassets/settings.imageset/settings.png diff --git a/AdLibs/AdLibs/Assets.xcassets/settings.imageset/settings@2x.png b/AdLibs/Resources/Assets.xcassets/settings.imageset/settings@2x.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/settings.imageset/settings@2x.png rename to AdLibs/Resources/Assets.xcassets/settings.imageset/settings@2x.png diff --git a/AdLibs/AdLibs/Assets.xcassets/settings.imageset/settings@3x.png b/AdLibs/Resources/Assets.xcassets/settings.imageset/settings@3x.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/settings.imageset/settings@3x.png rename to AdLibs/Resources/Assets.xcassets/settings.imageset/settings@3x.png diff --git a/AdLibs/AdLibs/Assets.xcassets/wackylibsstartscreen.imageset/Contents.json b/AdLibs/Resources/Assets.xcassets/wackylibsstartscreen.imageset/Contents.json similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/wackylibsstartscreen.imageset/Contents.json rename to AdLibs/Resources/Assets.xcassets/wackylibsstartscreen.imageset/Contents.json diff --git a/AdLibs/AdLibs/Assets.xcassets/wackylibsstartscreen.imageset/wackylibsstartscreen.png b/AdLibs/Resources/Assets.xcassets/wackylibsstartscreen.imageset/wackylibsstartscreen.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/wackylibsstartscreen.imageset/wackylibsstartscreen.png rename to AdLibs/Resources/Assets.xcassets/wackylibsstartscreen.imageset/wackylibsstartscreen.png diff --git a/AdLibs/AdLibs/Assets.xcassets/wackylibsstartscreen.png b/AdLibs/Resources/Assets.xcassets/wackylibsstartscreen.png similarity index 100% rename from AdLibs/AdLibs/Assets.xcassets/wackylibsstartscreen.png rename to AdLibs/Resources/Assets.xcassets/wackylibsstartscreen.png diff --git a/AdLibs/AdLibs/Base.lproj/LaunchScreen.storyboard b/AdLibs/Resources/Base.lproj/LaunchScreen.storyboard similarity index 89% rename from AdLibs/AdLibs/Base.lproj/LaunchScreen.storyboard rename to AdLibs/Resources/Base.lproj/LaunchScreen.storyboard index 116698d..2c2dc53 100644 --- a/AdLibs/AdLibs/Base.lproj/LaunchScreen.storyboard +++ b/AdLibs/Resources/Base.lproj/LaunchScreen.storyboard @@ -23,8 +23,8 @@ - - + + diff --git a/AdLibs/AdLibs/SceneDelegate.swift b/AdLibs/Resources/SceneDelegate.swift similarity index 100% rename from AdLibs/AdLibs/SceneDelegate.swift rename to AdLibs/Resources/SceneDelegate.swift