├── GoodAsOldPhones.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── GoodAsOldPhones ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json ├── button-addtocart.imageset │ ├── Contents.json │ └── button-addtocart@2x.png ├── header-contact.imageset │ ├── Contents.json │ └── header-contact@2x.png ├── icon-about-email.imageset │ ├── Contents.json │ └── icon-about-email@2x.png ├── icon-about-phone.imageset │ ├── Contents.json │ └── icon-about-phone@2x.png ├── icon-about-website.imageset │ ├── Contents.json │ └── icon-about-website@2x.png ├── icon-tabbar-cart.imageset │ ├── Contents.json │ └── icon-tabbar-cart@2x.png ├── icon-tabbar-contact.imageset │ ├── Contents.json │ └── icon-tabbar-contact@2x.png ├── icon-tabbar-store.imageset │ ├── Contents.json │ └── icon-tabbar-store@2x.png ├── image-cell1.imageset │ ├── Contents.json │ └── image-cell1@2x.png ├── image-cell2.imageset │ ├── Contents.json │ └── image-cell2@2x.png ├── image-cell3.imageset │ ├── Contents.json │ └── image-cell3@2x.png ├── image-cell4.imageset │ ├── Contents.json │ └── image-cell4@2x.png ├── phone-fullscreen1.imageset │ ├── Contents.json │ └── phone-fullscreen1@2x.png ├── phone-fullscreen2.imageset │ ├── Contents.json │ └── phone-fullscreen2@2x.png ├── phone-fullscreen3.imageset │ ├── Contents.json │ └── phone-fullscreen3@2x.png └── phone-fullscreen4.imageset │ ├── Contents.json │ └── phone-fullscreen4@2x.png ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── CartTableViewController.swift ├── ContactViewController.swift ├── Info.plist ├── Order.swift ├── Orders.swift ├── Product.swift ├── ProductViewController.swift └── ProductsTableViewController.swift /GoodAsOldPhones.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AB5300C51D81E80A00919F67 /* CartTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB5300C41D81E80A00919F67 /* CartTableViewController.swift */; }; 11 | AB5300C71D81E97900919F67 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB5300C61D81E97900919F67 /* Order.swift */; }; 12 | AB5300C91D81E97F00919F67 /* Orders.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB5300C81D81E97F00919F67 /* Orders.swift */; }; 13 | ABB604EC1D75F666001B4B45 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB604EB1D75F666001B4B45 /* AppDelegate.swift */; }; 14 | ABB604F11D75F666001B4B45 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB604EF1D75F666001B4B45 /* Main.storyboard */; }; 15 | ABB604F31D75F666001B4B45 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABB604F21D75F666001B4B45 /* Assets.xcassets */; }; 16 | ABB604F61D75F666001B4B45 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABB604F41D75F666001B4B45 /* LaunchScreen.storyboard */; }; 17 | ABB604FE1D75FD77001B4B45 /* ProductViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB604FD1D75FD77001B4B45 /* ProductViewController.swift */; }; 18 | ABB605041D762D4D001B4B45 /* ContactViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB605031D762D4D001B4B45 /* ContactViewController.swift */; }; 19 | ABB605061D77466E001B4B45 /* ProductsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB605051D77466E001B4B45 /* ProductsTableViewController.swift */; }; 20 | ABB605081D774AEB001B4B45 /* Product.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB605071D774AEB001B4B45 /* Product.swift */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | AB5300C41D81E80A00919F67 /* CartTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CartTableViewController.swift; sourceTree = ""; }; 25 | AB5300C61D81E97900919F67 /* Order.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = ""; }; 26 | AB5300C81D81E97F00919F67 /* Orders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Orders.swift; sourceTree = ""; }; 27 | ABB604E81D75F666001B4B45 /* GoodAsOldPhones.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GoodAsOldPhones.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | ABB604EB1D75F666001B4B45 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 29 | ABB604F01D75F666001B4B45 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | ABB604F21D75F666001B4B45 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 31 | ABB604F51D75F666001B4B45 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 32 | ABB604F71D75F666001B4B45 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | ABB604FD1D75FD77001B4B45 /* ProductViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductViewController.swift; sourceTree = ""; }; 34 | ABB605031D762D4D001B4B45 /* ContactViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactViewController.swift; sourceTree = ""; }; 35 | ABB605051D77466E001B4B45 /* ProductsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductsTableViewController.swift; sourceTree = ""; }; 36 | ABB605071D774AEB001B4B45 /* Product.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Product.swift; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | ABB604E51D75F666001B4B45 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | ABB604DF1D75F666001B4B45 = { 51 | isa = PBXGroup; 52 | children = ( 53 | ABB604EA1D75F666001B4B45 /* GoodAsOldPhones */, 54 | ABB604E91D75F666001B4B45 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | ABB604E91D75F666001B4B45 /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | ABB604E81D75F666001B4B45 /* GoodAsOldPhones.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | ABB604EA1D75F666001B4B45 /* GoodAsOldPhones */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | ABB604EB1D75F666001B4B45 /* AppDelegate.swift */, 70 | ABB604EF1D75F666001B4B45 /* Main.storyboard */, 71 | ABB604F21D75F666001B4B45 /* Assets.xcassets */, 72 | ABB604F41D75F666001B4B45 /* LaunchScreen.storyboard */, 73 | ABB604F71D75F666001B4B45 /* Info.plist */, 74 | ABB604FD1D75FD77001B4B45 /* ProductViewController.swift */, 75 | ABB605031D762D4D001B4B45 /* ContactViewController.swift */, 76 | ABB605051D77466E001B4B45 /* ProductsTableViewController.swift */, 77 | ABB605071D774AEB001B4B45 /* Product.swift */, 78 | AB5300C41D81E80A00919F67 /* CartTableViewController.swift */, 79 | AB5300C61D81E97900919F67 /* Order.swift */, 80 | AB5300C81D81E97F00919F67 /* Orders.swift */, 81 | ); 82 | path = GoodAsOldPhones; 83 | sourceTree = ""; 84 | }; 85 | /* End PBXGroup section */ 86 | 87 | /* Begin PBXNativeTarget section */ 88 | ABB604E71D75F666001B4B45 /* GoodAsOldPhones */ = { 89 | isa = PBXNativeTarget; 90 | buildConfigurationList = ABB604FA1D75F666001B4B45 /* Build configuration list for PBXNativeTarget "GoodAsOldPhones" */; 91 | buildPhases = ( 92 | ABB604E41D75F666001B4B45 /* Sources */, 93 | ABB604E51D75F666001B4B45 /* Frameworks */, 94 | ABB604E61D75F666001B4B45 /* Resources */, 95 | ); 96 | buildRules = ( 97 | ); 98 | dependencies = ( 99 | ); 100 | name = GoodAsOldPhones; 101 | productName = GoodAsOldPhones; 102 | productReference = ABB604E81D75F666001B4B45 /* GoodAsOldPhones.app */; 103 | productType = "com.apple.product-type.application"; 104 | }; 105 | /* End PBXNativeTarget section */ 106 | 107 | /* Begin PBXProject section */ 108 | ABB604E01D75F666001B4B45 /* Project object */ = { 109 | isa = PBXProject; 110 | attributes = { 111 | LastSwiftUpdateCheck = 0800; 112 | LastUpgradeCheck = 0800; 113 | ORGANIZATIONNAME = "Code School"; 114 | TargetAttributes = { 115 | ABB604E71D75F666001B4B45 = { 116 | CreatedOnToolsVersion = 8.0; 117 | LastSwiftMigration = 0830; 118 | ProvisioningStyle = Automatic; 119 | }; 120 | }; 121 | }; 122 | buildConfigurationList = ABB604E31D75F666001B4B45 /* Build configuration list for PBXProject "GoodAsOldPhones" */; 123 | compatibilityVersion = "Xcode 3.2"; 124 | developmentRegion = English; 125 | hasScannedForEncodings = 0; 126 | knownRegions = ( 127 | en, 128 | Base, 129 | ); 130 | mainGroup = ABB604DF1D75F666001B4B45; 131 | productRefGroup = ABB604E91D75F666001B4B45 /* Products */; 132 | projectDirPath = ""; 133 | projectRoot = ""; 134 | targets = ( 135 | ABB604E71D75F666001B4B45 /* GoodAsOldPhones */, 136 | ); 137 | }; 138 | /* End PBXProject section */ 139 | 140 | /* Begin PBXResourcesBuildPhase section */ 141 | ABB604E61D75F666001B4B45 /* Resources */ = { 142 | isa = PBXResourcesBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | ABB604F61D75F666001B4B45 /* LaunchScreen.storyboard in Resources */, 146 | ABB604F31D75F666001B4B45 /* Assets.xcassets in Resources */, 147 | ABB604F11D75F666001B4B45 /* Main.storyboard in Resources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXResourcesBuildPhase section */ 152 | 153 | /* Begin PBXSourcesBuildPhase section */ 154 | ABB604E41D75F666001B4B45 /* Sources */ = { 155 | isa = PBXSourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | ABB604FE1D75FD77001B4B45 /* ProductViewController.swift in Sources */, 159 | AB5300C51D81E80A00919F67 /* CartTableViewController.swift in Sources */, 160 | ABB605061D77466E001B4B45 /* ProductsTableViewController.swift in Sources */, 161 | ABB605081D774AEB001B4B45 /* Product.swift in Sources */, 162 | ABB604EC1D75F666001B4B45 /* AppDelegate.swift in Sources */, 163 | ABB605041D762D4D001B4B45 /* ContactViewController.swift in Sources */, 164 | AB5300C91D81E97F00919F67 /* Orders.swift in Sources */, 165 | AB5300C71D81E97900919F67 /* Order.swift in Sources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXSourcesBuildPhase section */ 170 | 171 | /* Begin PBXVariantGroup section */ 172 | ABB604EF1D75F666001B4B45 /* Main.storyboard */ = { 173 | isa = PBXVariantGroup; 174 | children = ( 175 | ABB604F01D75F666001B4B45 /* Base */, 176 | ); 177 | name = Main.storyboard; 178 | sourceTree = ""; 179 | }; 180 | ABB604F41D75F666001B4B45 /* LaunchScreen.storyboard */ = { 181 | isa = PBXVariantGroup; 182 | children = ( 183 | ABB604F51D75F666001B4B45 /* Base */, 184 | ); 185 | name = LaunchScreen.storyboard; 186 | sourceTree = ""; 187 | }; 188 | /* End PBXVariantGroup section */ 189 | 190 | /* Begin XCBuildConfiguration section */ 191 | ABB604F81D75F666001B4B45 /* Debug */ = { 192 | isa = XCBuildConfiguration; 193 | buildSettings = { 194 | ALWAYS_SEARCH_USER_PATHS = NO; 195 | CLANG_ANALYZER_NONNULL = YES; 196 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 197 | CLANG_CXX_LIBRARY = "libc++"; 198 | CLANG_ENABLE_MODULES = YES; 199 | CLANG_ENABLE_OBJC_ARC = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_CONSTANT_CONVERSION = YES; 202 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 203 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 204 | CLANG_WARN_EMPTY_BODY = YES; 205 | CLANG_WARN_ENUM_CONVERSION = YES; 206 | CLANG_WARN_INFINITE_RECURSION = YES; 207 | CLANG_WARN_INT_CONVERSION = YES; 208 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 209 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 210 | CLANG_WARN_UNREACHABLE_CODE = YES; 211 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 212 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 213 | COPY_PHASE_STRIP = NO; 214 | DEBUG_INFORMATION_FORMAT = dwarf; 215 | ENABLE_STRICT_OBJC_MSGSEND = YES; 216 | ENABLE_TESTABILITY = YES; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 227 | GCC_WARN_UNDECLARED_SELECTOR = YES; 228 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 229 | GCC_WARN_UNUSED_FUNCTION = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 232 | MTL_ENABLE_DEBUG_INFO = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = iphoneos; 235 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 236 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 237 | SWIFT_VERSION = 3.0; 238 | }; 239 | name = Debug; 240 | }; 241 | ABB604F91D75F666001B4B45 /* Release */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_WARN_BOOL_CONVERSION = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 253 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 254 | CLANG_WARN_EMPTY_BODY = YES; 255 | CLANG_WARN_ENUM_CONVERSION = YES; 256 | CLANG_WARN_INFINITE_RECURSION = YES; 257 | CLANG_WARN_INT_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 279 | SWIFT_VERSION = 3.0; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Release; 283 | }; 284 | ABB604FB1D75F666001B4B45 /* Debug */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 288 | INFOPLIST_FILE = GoodAsOldPhones/Info.plist; 289 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 290 | PRODUCT_BUNDLE_IDENTIFIER = com.codeschool.GoodAsOldPhones; 291 | PRODUCT_NAME = "$(TARGET_NAME)"; 292 | SWIFT_VERSION = 3.0; 293 | }; 294 | name = Debug; 295 | }; 296 | ABB604FC1D75F666001B4B45 /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 300 | INFOPLIST_FILE = GoodAsOldPhones/Info.plist; 301 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 302 | PRODUCT_BUNDLE_IDENTIFIER = com.codeschool.GoodAsOldPhones; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | SWIFT_VERSION = 3.0; 305 | }; 306 | name = Release; 307 | }; 308 | /* End XCBuildConfiguration section */ 309 | 310 | /* Begin XCConfigurationList section */ 311 | ABB604E31D75F666001B4B45 /* Build configuration list for PBXProject "GoodAsOldPhones" */ = { 312 | isa = XCConfigurationList; 313 | buildConfigurations = ( 314 | ABB604F81D75F666001B4B45 /* Debug */, 315 | ABB604F91D75F666001B4B45 /* Release */, 316 | ); 317 | defaultConfigurationIsVisible = 0; 318 | defaultConfigurationName = Release; 319 | }; 320 | ABB604FA1D75F666001B4B45 /* Build configuration list for PBXNativeTarget "GoodAsOldPhones" */ = { 321 | isa = XCConfigurationList; 322 | buildConfigurations = ( 323 | ABB604FB1D75F666001B4B45 /* Debug */, 324 | ABB604FC1D75F666001B4B45 /* Release */, 325 | ); 326 | defaultConfigurationIsVisible = 0; 327 | defaultConfigurationName = Release; 328 | }; 329 | /* End XCConfigurationList section */ 330 | }; 331 | rootObject = ABB604E01D75F666001B4B45 /* Project object */; 332 | } 333 | -------------------------------------------------------------------------------- /GoodAsOldPhones.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GoodAsOldPhones/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 8/30/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/button-addtocart.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "button-addtocart@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/button-addtocart.imageset/button-addtocart@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/button-addtocart.imageset/button-addtocart@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/header-contact.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "header-contact@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/header-contact.imageset/header-contact@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/header-contact.imageset/header-contact@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-about-email.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon-about-email@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-about-email.imageset/icon-about-email@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/icon-about-email.imageset/icon-about-email@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-about-phone.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon-about-phone@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-about-phone.imageset/icon-about-phone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/icon-about-phone.imageset/icon-about-phone@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-about-website.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "icon-about-website@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-about-website.imageset/icon-about-website@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/icon-about-website.imageset/icon-about-website@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-tabbar-cart.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon-tabbar-cart@2x.png", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "version" : 1, 11 | "author" : "xcode" 12 | } 13 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-tabbar-cart.imageset/icon-tabbar-cart@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/icon-tabbar-cart.imageset/icon-tabbar-cart@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-tabbar-contact.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon-tabbar-contact@2x.png", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "version" : 1, 11 | "author" : "xcode" 12 | } 13 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-tabbar-contact.imageset/icon-tabbar-contact@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/icon-tabbar-contact.imageset/icon-tabbar-contact@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-tabbar-store.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon-tabbar-store@2x.png", 6 | "scale" : "2x" 7 | } 8 | ], 9 | "info" : { 10 | "version" : 1, 11 | "author" : "xcode" 12 | } 13 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/icon-tabbar-store.imageset/icon-tabbar-store@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/icon-tabbar-store.imageset/icon-tabbar-store@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "image-cell1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell1.imageset/image-cell1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/image-cell1.imageset/image-cell1@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "image-cell2@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell2.imageset/image-cell2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/image-cell2.imageset/image-cell2@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "image-cell3@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell3.imageset/image-cell3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/image-cell3.imageset/image-cell3@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "image-cell4@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/image-cell4.imageset/image-cell4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/image-cell4.imageset/image-cell4@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "phone-fullscreen1@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen1.imageset/phone-fullscreen1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/phone-fullscreen1.imageset/phone-fullscreen1@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "phone-fullscreen2@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen2.imageset/phone-fullscreen2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/phone-fullscreen2.imageset/phone-fullscreen2@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "phone-fullscreen3@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen3.imageset/phone-fullscreen3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/phone-fullscreen3.imageset/phone-fullscreen3@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "phone-fullscreen4@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /GoodAsOldPhones/Assets.xcassets/phone-fullscreen4.imageset/phone-fullscreen4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeschool/WatchUsBuild-StoreiOSAppWithSwift3/e72a32c5b6e51340231201e0e4b8fab02d928bec/GoodAsOldPhones/Assets.xcassets/phone-fullscreen4.imageset/phone-fullscreen4@2x.png -------------------------------------------------------------------------------- /GoodAsOldPhones/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /GoodAsOldPhones/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 86 | 93 | 101 | 109 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 135 | 142 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | -------------------------------------------------------------------------------- /GoodAsOldPhones/CartTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CartTableViewController.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 9/8/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CartTableViewController: UITableViewController { 12 | 13 | var orders: [Order]? { 14 | didSet { 15 | 16 | } 17 | } 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | } 23 | 24 | override func viewWillAppear(_ animated: Bool) { 25 | super.viewWillAppear(animated) 26 | 27 | orders = Orders.readOrdersFromArchive() 28 | tableView.reloadData() 29 | } 30 | 31 | // MARK: - Table view data source 32 | 33 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 34 | return orders?.count ?? 0 35 | } 36 | 37 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 38 | let cell = tableView.dequeueReusableCell(withIdentifier: "CartCell", for: indexPath) 39 | 40 | let order = orders?[indexPath.row] 41 | 42 | cell.textLabel?.text = order?.product?.name 43 | 44 | return cell 45 | } 46 | 47 | // Override to support editing the table view. 48 | override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { 49 | if editingStyle == .delete { 50 | // Delete the row from the data source 51 | 52 | orders?.remove(at: indexPath.row) 53 | 54 | if let orders = orders { 55 | let _ = Orders.saveOrdersToArchive(orders: orders) 56 | } 57 | 58 | tableView.deleteRows(at: [indexPath], with: .fade) 59 | 60 | } else if editingStyle == .insert { 61 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /GoodAsOldPhones/ContactViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContactViewController.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 8/30/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ContactViewController: UIViewController { 12 | 13 | @IBOutlet weak var scrollView: UIScrollView! 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | view.addSubview(scrollView) 18 | } 19 | 20 | override func viewWillLayoutSubviews() { 21 | super.viewWillLayoutSubviews() 22 | 23 | scrollView.contentSize = CGSize(width: 375, height: 800) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /GoodAsOldPhones/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /GoodAsOldPhones/Order.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Order.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 9/8/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Order: NSObject, NSCoding { 12 | var order_id: Int? 13 | var product: Product? 14 | 15 | override init() { 16 | super.init() 17 | } 18 | 19 | required init?(coder aDecoder: NSCoder) { 20 | self.order_id = aDecoder.decodeObject(forKey: "order_id") as! Int? 21 | self.product = aDecoder.decodeObject(forKey: "product") as! Product? 22 | } 23 | 24 | func encode(with aCoder: NSCoder) { 25 | aCoder.encode(self.order_id, forKey: "order_id") 26 | aCoder.encode(self.product, forKey: "product") 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /GoodAsOldPhones/Orders.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Orders.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 9/8/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Orders: NSObject, NSCoding { 12 | var orders: [Order]? 13 | 14 | required init?(coder aDecoder: NSCoder) { 15 | self.orders = aDecoder.decodeObject(forKey: "orders") as! [Order]? 16 | } 17 | 18 | func encode(with aCoder: NSCoder) { 19 | aCoder.encode(self.orders, forKey: "orders") 20 | } 21 | 22 | class func archiveFilePath() -> String { 23 | let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] 24 | return documentsDirectory.appendingPathComponent("cart.archive").path 25 | } 26 | 27 | class func readOrdersFromArchive() -> [Order]? { 28 | return NSKeyedUnarchiver.unarchiveObject(withFile: archiveFilePath()) as? [Order] 29 | } 30 | 31 | class func saveOrdersToArchive(orders: [Order]) -> Bool { 32 | return NSKeyedArchiver.archiveRootObject(orders, toFile: archiveFilePath()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /GoodAsOldPhones/Product.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Product.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 8/31/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Product: NSObject, NSCoding { 12 | var name: String? 13 | var productImage: String? 14 | var cellImage: String? 15 | var price: Double? 16 | 17 | override init() { 18 | super.init() 19 | } 20 | 21 | required init?(coder aDecoder: NSCoder) { 22 | self.name = aDecoder.decodeObject(forKey: "name") as! String? 23 | self.productImage = aDecoder.decodeObject(forKey: "productImage") as! String? 24 | self.cellImage = aDecoder.decodeObject(forKey: "cellImage") as! String? 25 | self.price = aDecoder.decodeObject(forKey: "price") as! Double? 26 | } 27 | 28 | func encode(with aCoder: NSCoder) { 29 | aCoder.encode(self.name, forKey: "name") 30 | aCoder.encode(self.productImage, forKey: "productImage") 31 | aCoder.encode(self.cellImage, forKey: "cellImage") 32 | aCoder.encode(self.price, forKey: "price") 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /GoodAsOldPhones/ProductViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProductViewController.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 8/30/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ProductViewController: UIViewController { 12 | 13 | @IBOutlet weak var productNameLabel: UILabel! 14 | @IBOutlet weak var productImageView: UIImageView! 15 | 16 | var product: Product? 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | if let p = product { 22 | productNameLabel.text = p.name 23 | if let i = p.productImage { 24 | productImageView.image = UIImage(named: i) 25 | } 26 | } 27 | } 28 | 29 | @IBAction func addToCartPressed(_ sender: AnyObject) -> Void { 30 | print("Button tapped") 31 | 32 | guard let product = product, let price = product.price else { 33 | return 34 | } 35 | 36 | let alertController = UIAlertController(title: "Saved to Cart", message: "Saved to cart with a price of \(price)", preferredStyle: .alert) 37 | let action = UIAlertAction(title: "OK", style: .default, handler: nil) 38 | alertController.addAction(action) 39 | 40 | let order = Order() 41 | order.order_id = 1 42 | order.product = product 43 | 44 | var orders = Orders.readOrdersFromArchive() 45 | 46 | /* fix: Added 01/03/2017 47 | We forgot to add this logic during the recording of the Watch Us Build 48 | Check if the orders array exists. If it doesn't, then create a new array with a single order in it. 49 | If the orders array does exist, then just append the new order to it. 50 | */ 51 | if(orders == nil) { 52 | orders = [order] 53 | } else { 54 | orders?.append(order) 55 | } 56 | 57 | if let orders = orders { 58 | if(Orders.saveOrdersToArchive(orders: orders)) { 59 | present(alertController, animated: true, completion: nil) 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /GoodAsOldPhones/ProductsTableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProductsTableViewController.swift 3 | // GoodAsOldPhones 4 | // 5 | // Created by Jon Friskics on 8/31/16. 6 | // Copyright © 2016 Code School. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ProductsTableViewController: UITableViewController { 12 | 13 | var products: [Product]? 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | let product1 = Product() 19 | let product2 = Product() 20 | let product3 = Product() 21 | let product4 = Product() 22 | 23 | product1.name = "1907 Wall Set" 24 | product1.productImage = "phone-fullscreen1" 25 | product1.cellImage = "image-cell1" 26 | product1.price = 19.99 27 | 28 | product2.name = "1921 Dial Phone" 29 | product2.productImage = "phone-fullscreen2" 30 | product2.cellImage = "image-cell2" 31 | product2.price = 9.99 32 | 33 | product3.name = "1937 Desk Set" 34 | product3.productImage = "phone-fullscreen3" 35 | product3.cellImage = "image-cell3" 36 | product3.price = 59.99 37 | 38 | product4.name = "1984 Motorola Portable" 39 | product4.productImage = "phone-fullscreen4" 40 | product4.cellImage = "image-cell4" 41 | product4.price = 0.99 42 | 43 | products = [product1, product2, product3, product4] 44 | } 45 | 46 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 47 | if let p = products { 48 | return p.count 49 | } 50 | return 0 51 | } 52 | 53 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 54 | let cell = tableView.dequeueReusableCell(withIdentifier: "ProductCell", for: indexPath) 55 | 56 | let product = products?[indexPath.row] 57 | 58 | if let p = product { 59 | cell.textLabel?.text = p.name 60 | if let i = p.cellImage { 61 | cell.imageView?.image = UIImage(named: i) 62 | } 63 | 64 | } 65 | 66 | 67 | 68 | return cell 69 | } 70 | 71 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 72 | if segue.identifier == "ShowProduct" { 73 | let productVC = segue.destination as? ProductViewController 74 | 75 | guard let cell = sender as? UITableViewCell, 76 | let indexPath = tableView.indexPath(for: cell) else { 77 | return 78 | } 79 | productVC?.product = products?[indexPath.row] 80 | } 81 | } 82 | } 83 | --------------------------------------------------------------------------------