diff --git a/gigs/gigs.xcodeproj/project.pbxproj b/gigs/gigs.xcodeproj/project.pbxproj new file mode 100644 index 00000000..6a422d27 --- /dev/null +++ b/gigs/gigs.xcodeproj/project.pbxproj @@ -0,0 +1,389 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 0DDFAF7C246219A3009BD222 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF7B246219A3009BD222 /* AppDelegate.swift */; }; + 0DDFAF7E246219A3009BD222 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF7D246219A3009BD222 /* SceneDelegate.swift */; }; + 0DDFAF83246219A3009BD222 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0DDFAF81246219A3009BD222 /* Main.storyboard */; }; + 0DDFAF85246219A6009BD222 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0DDFAF84246219A6009BD222 /* Assets.xcassets */; }; + 0DDFAF88246219A6009BD222 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0DDFAF86246219A6009BD222 /* LaunchScreen.storyboard */; }; + 0DDFAF9024621ABD009BD222 /* GigsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF8F24621ABD009BD222 /* GigsTableViewController.swift */; }; + 0DDFAF9224622293009BD222 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF9124622293009BD222 /* LoginViewController.swift */; }; + 0DDFAF9424622EEC009BD222 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF9324622EEC009BD222 /* User.swift */; }; + 0DDFAF9624622F4A009BD222 /* Bearer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF9524622F4A009BD222 /* Bearer.swift */; }; + 0DDFAF9924622FD5009BD222 /* GigController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFAF9824622FD5009BD222 /* GigController.swift */; }; + 0DE46F11246373EF00EC2A30 /* GigDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE46F10246373EF00EC2A30 /* GigDetailViewController.swift */; }; + 0DE46F132463783700EC2A30 /* Gig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE46F122463783700EC2A30 /* Gig.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0DDFAF78246219A3009BD222 /* gigs.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = gigs.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0DDFAF7B246219A3009BD222 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 0DDFAF7D246219A3009BD222 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 0DDFAF82246219A3009BD222 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 0DDFAF84246219A6009BD222 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 0DDFAF87246219A6009BD222 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 0DDFAF89246219A6009BD222 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 0DDFAF8F24621ABD009BD222 /* GigsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigsTableViewController.swift; sourceTree = ""; }; + 0DDFAF9124622293009BD222 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; + 0DDFAF9324622EEC009BD222 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + 0DDFAF9524622F4A009BD222 /* Bearer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bearer.swift; sourceTree = ""; }; + 0DDFAF9824622FD5009BD222 /* GigController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigController.swift; sourceTree = ""; }; + 0DE46F10246373EF00EC2A30 /* GigDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigDetailViewController.swift; sourceTree = ""; }; + 0DE46F122463783700EC2A30 /* Gig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Gig.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0DDFAF75246219A3009BD222 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0D977A76247B161F00BCFADA /* VCs */ = { + isa = PBXGroup; + children = ( + 0DDFAF9124622293009BD222 /* LoginViewController.swift */, + 0DDFAF8F24621ABD009BD222 /* GigsTableViewController.swift */, + 0DE46F10246373EF00EC2A30 /* GigDetailViewController.swift */, + ); + path = VCs; + sourceTree = ""; + }; + 0D977A77247B163800BCFADA /* model controller */ = { + isa = PBXGroup; + children = ( + 0DDFAF9824622FD5009BD222 /* GigController.swift */, + ); + path = "model controller"; + sourceTree = ""; + }; + 0DDFAF6F246219A3009BD222 = { + isa = PBXGroup; + children = ( + 0DDFAF7A246219A3009BD222 /* gigs */, + 0DDFAF79246219A3009BD222 /* Products */, + ); + sourceTree = ""; + }; + 0DDFAF79246219A3009BD222 /* Products */ = { + isa = PBXGroup; + children = ( + 0DDFAF78246219A3009BD222 /* gigs.app */, + ); + name = Products; + sourceTree = ""; + }; + 0DDFAF7A246219A3009BD222 /* gigs */ = { + isa = PBXGroup; + children = ( + 0DDFAF7B246219A3009BD222 /* AppDelegate.swift */, + 0DDFAF7D246219A3009BD222 /* SceneDelegate.swift */, + 0DDFAF81246219A3009BD222 /* Main.storyboard */, + 0DDFAF9724622F69009BD222 /* Model */, + 0D977A77247B163800BCFADA /* model controller */, + 0D977A76247B161F00BCFADA /* VCs */, + 0DDFAF84246219A6009BD222 /* Assets.xcassets */, + 0DDFAF86246219A6009BD222 /* LaunchScreen.storyboard */, + 0DDFAF89246219A6009BD222 /* Info.plist */, + ); + path = gigs; + sourceTree = ""; + }; + 0DDFAF9724622F69009BD222 /* Model */ = { + isa = PBXGroup; + children = ( + 0DDFAF9524622F4A009BD222 /* Bearer.swift */, + 0DDFAF9324622EEC009BD222 /* User.swift */, + 0DE46F122463783700EC2A30 /* Gig.swift */, + ); + path = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0DDFAF77246219A3009BD222 /* gigs */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0DDFAF8C246219A6009BD222 /* Build configuration list for PBXNativeTarget "gigs" */; + buildPhases = ( + 0DDFAF74246219A3009BD222 /* Sources */, + 0DDFAF75246219A3009BD222 /* Frameworks */, + 0DDFAF76246219A3009BD222 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = gigs; + productName = gigs; + productReference = 0DDFAF78246219A3009BD222 /* gigs.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0DDFAF70246219A3009BD222 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1140; + LastUpgradeCheck = 1140; + ORGANIZATIONNAME = HenryQuante; + TargetAttributes = { + 0DDFAF77246219A3009BD222 = { + CreatedOnToolsVersion = 11.4.1; + }; + }; + }; + buildConfigurationList = 0DDFAF73246219A3009BD222 /* Build configuration list for PBXProject "gigs" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 0DDFAF6F246219A3009BD222; + productRefGroup = 0DDFAF79246219A3009BD222 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 0DDFAF77246219A3009BD222 /* gigs */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 0DDFAF76246219A3009BD222 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0DDFAF88246219A6009BD222 /* LaunchScreen.storyboard in Resources */, + 0DDFAF85246219A6009BD222 /* Assets.xcassets in Resources */, + 0DDFAF83246219A3009BD222 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0DDFAF74246219A3009BD222 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0DDFAF9224622293009BD222 /* LoginViewController.swift in Sources */, + 0DE46F11246373EF00EC2A30 /* GigDetailViewController.swift in Sources */, + 0DDFAF9924622FD5009BD222 /* GigController.swift in Sources */, + 0DDFAF7C246219A3009BD222 /* AppDelegate.swift in Sources */, + 0DDFAF9624622F4A009BD222 /* Bearer.swift in Sources */, + 0DDFAF7E246219A3009BD222 /* SceneDelegate.swift in Sources */, + 0DDFAF9424622EEC009BD222 /* User.swift in Sources */, + 0DDFAF9024621ABD009BD222 /* GigsTableViewController.swift in Sources */, + 0DE46F132463783700EC2A30 /* Gig.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 0DDFAF81246219A3009BD222 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 0DDFAF82246219A3009BD222 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 0DDFAF86246219A6009BD222 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 0DDFAF87246219A6009BD222 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 0DDFAF8A246219A6009BD222 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 0DDFAF8B246219A6009BD222 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 0DDFAF8D246219A6009BD222 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = gigs/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = rgh.gigs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 0DDFAF8E246219A6009BD222 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = gigs/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = rgh.gigs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0DDFAF73246219A3009BD222 /* Build configuration list for PBXProject "gigs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DDFAF8A246219A6009BD222 /* Debug */, + 0DDFAF8B246219A6009BD222 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0DDFAF8C246219A6009BD222 /* Build configuration list for PBXNativeTarget "gigs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0DDFAF8D246219A6009BD222 /* Debug */, + 0DDFAF8E246219A6009BD222 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0DDFAF70246219A3009BD222 /* Project object */; +} diff --git a/gigs/gigs.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/gigs/gigs.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..e731b7f9 --- /dev/null +++ b/gigs/gigs.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/gigs/gigs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/gigs/gigs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/gigs/gigs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/gigs/gigs.xcodeproj/project.xcworkspace/xcuserdata/turing.xcuserdatad/UserInterfaceState.xcuserstate b/gigs/gigs.xcodeproj/project.xcworkspace/xcuserdata/turing.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..5c25ce73 Binary files /dev/null and b/gigs/gigs.xcodeproj/project.xcworkspace/xcuserdata/turing.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/gigs/gigs.xcodeproj/xcuserdata/turing.xcuserdatad/xcschemes/xcschememanagement.plist b/gigs/gigs.xcodeproj/xcuserdata/turing.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..d5f8ccaf --- /dev/null +++ b/gigs/gigs.xcodeproj/xcuserdata/turing.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + gigs.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/gigs/gigs/AppDelegate.swift b/gigs/gigs/AppDelegate.swift new file mode 100644 index 00000000..8eb7f9bc --- /dev/null +++ b/gigs/gigs/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/gigs/gigs/Assets.xcassets/AppIcon.appiconset/Contents.json b/gigs/gigs/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/gigs/gigs/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/gigs/gigs/Assets.xcassets/Contents.json b/gigs/gigs/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/gigs/gigs/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/gigs/gigs/Base.lproj/LaunchScreen.storyboard b/gigs/gigs/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/gigs/gigs/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gigs/gigs/Base.lproj/Main.storyboard b/gigs/gigs/Base.lproj/Main.storyboard new file mode 100644 index 00000000..da8de794 --- /dev/null +++ b/gigs/gigs/Base.lproj/Main.storyboard @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gigs/gigs/Info.plist b/gigs/gigs/Info.plist new file mode 100644 index 00000000..2a3483c0 --- /dev/null +++ b/gigs/gigs/Info.plist @@ -0,0 +1,64 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/gigs/gigs/Model/Bearer.swift b/gigs/gigs/Model/Bearer.swift new file mode 100644 index 00000000..3d01579c --- /dev/null +++ b/gigs/gigs/Model/Bearer.swift @@ -0,0 +1,13 @@ +// +// Bearer.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import Foundation + +struct Bearer: Codable { + let token: String +} diff --git a/gigs/gigs/Model/Gig.swift b/gigs/gigs/Model/Gig.swift new file mode 100644 index 00000000..3fb03365 --- /dev/null +++ b/gigs/gigs/Model/Gig.swift @@ -0,0 +1,15 @@ +// +// Gig.swift +// gigs +// +// Created by ronald huston jr on 5/6/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import Foundation + +struct Gig: Codable { + let title: String + let description: String + let dueDate: Date +} diff --git a/gigs/gigs/Model/User.swift b/gigs/gigs/Model/User.swift new file mode 100644 index 00000000..46114c16 --- /dev/null +++ b/gigs/gigs/Model/User.swift @@ -0,0 +1,14 @@ +// +// User.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import Foundation + +struct User: Codable { + let username: String + let password: String +} diff --git a/gigs/gigs/SceneDelegate.swift b/gigs/gigs/SceneDelegate.swift new file mode 100644 index 00000000..40e7b6ec --- /dev/null +++ b/gigs/gigs/SceneDelegate.swift @@ -0,0 +1,53 @@ +// +// SceneDelegate.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/gigs/gigs/VCs/GigDetailViewController.swift b/gigs/gigs/VCs/GigDetailViewController.swift new file mode 100644 index 00000000..127a9c86 --- /dev/null +++ b/gigs/gigs/VCs/GigDetailViewController.swift @@ -0,0 +1,41 @@ +// +// GigDetailViewController.swift +// gigs +// +// Created by ronald huston jr on 5/6/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import UIKit + +class GigDetailViewController: UIViewController { + + var gig: Gig? + var gigController: GigController! + + @IBOutlet weak var gigNameTextField: UITextField! + @IBOutlet weak var dueDate: UIDatePicker! + @IBOutlet weak var descriptionTextView: UITextView! + + + override func viewDidLoad() { + super.viewDidLoad() + + } + + @IBAction func save(_ sender: Any) { + guard let gigName = gigNameTextField.text, + gigName.isEmpty == false, + let description = descriptionTextView.text + else { + return + } + + let gig = Gig(title: gigName, description: description, dueDate: dueDate.date) + + // may want to implement .postGig method to save functionality + // it doesn't look like save method will work considering the way + // postGig() method is built... + } + +} diff --git a/gigs/gigs/VCs/GigsTableViewController.swift b/gigs/gigs/VCs/GigsTableViewController.swift new file mode 100644 index 00000000..baaf66e9 --- /dev/null +++ b/gigs/gigs/VCs/GigsTableViewController.swift @@ -0,0 +1,58 @@ +// +// GigsTableViewController.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import UIKit + +class GigsTableViewController: UITableViewController { + + // MARK: - property + let gigController = GigController() + + + override func viewDidLoad() { + super.viewDidLoad() + + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + if gigController.bearer == nil { + performSegue(withIdentifier: "Gigs", sender: self) + } + } + + + // MARK: - Table view data source + + + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + + return 0 + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "", for: indexPath) + + return cell + } + + + // 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 == "Gigs" { + if let loginVC = segue.destination as? LoginViewController { + loginVC.gigController = gigController + } + } + } + +} diff --git a/gigs/gigs/VCs/LoginViewController.swift b/gigs/gigs/VCs/LoginViewController.swift new file mode 100644 index 00000000..cdfe4a7a --- /dev/null +++ b/gigs/gigs/VCs/LoginViewController.swift @@ -0,0 +1,105 @@ +// +// LoginViewController.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import UIKit + +enum LoginType { + case signIn + case signUp +} + +class LoginViewController: UIViewController { + + var gigController: GigController? + + var loginType = LoginType.signUp + + var selectLoginType: LoginType = .signIn { + didSet { + switch selectLoginType { + case .signIn: + signUpButton.setTitle("log in", for: .normal) + case .signUp: + signUpButton.setTitle("sign up", for: .normal) + } + } + } + + // MARK: - UI connections + @IBOutlet weak var signUpSegment: UISegmentedControl! + @IBOutlet weak var usernameTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var signUpButton: UIButton! + + + override func viewDidLoad() { + super.viewDidLoad() + + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + usernameTextField.becomeFirstResponder() + } + + // MARK: - IBAction + @IBAction func segmentedControlAction(_ sender: Any) { + + switch signUpSegment.selectedSegmentIndex { + case 0: + selectLoginType = .signUp + passwordTextField.textContentType = .password + case 1: + selectLoginType = .signIn + passwordTextField.textContentType = .newPassword + default: fatalError() + } + } + + @IBAction func buttonTapped(_ sender: Any) { + // create user from textfield + guard let username = usernameTextField.text, + let password = passwordTextField.text, !password.isEmpty, !username.isEmpty else { return } + + let user = User(username: username, password: password) + + if loginType == .signUp { + gigController?.signUp(with: user, completion: { (networkError) in + if let error = networkError { + NSLog("error during signup: \(error)") + } else { + let alert = UIAlertController(title: "signup success", message: "please sign in", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + + DispatchQueue.main.async { + self.present(alert, animated: true) { + self.loginType = .signIn + self.signUpSegment.selectedSegmentIndex = 1 + self.signUpButton.setTitle("sign in", for: .normal) + } + } + } + }) + } + } + + @IBAction func signInTypeChanged(_ sender: UISegmentedControl) { + // switch UI between login types + if sender.selectedSegmentIndex == 0 { + // sign up + selectLoginType = .signUp + signUpButton.setTitle("sign up", for: .normal) + } else { + // sign in + selectLoginType = .signIn + signUpButton.setTitle("sign in", for: .normal) + } + } +} diff --git a/gigs/gigs/model controller/GigController.swift b/gigs/gigs/model controller/GigController.swift new file mode 100644 index 00000000..cf7cac93 --- /dev/null +++ b/gigs/gigs/model controller/GigController.swift @@ -0,0 +1,214 @@ +// +// GigController.swift +// gigs +// +// Created by ronald huston jr on 5/5/20. +// Copyright © 2020 HenryQuante. All rights reserved. +// + +import Foundation +import UIKit + +final class GigController { + + // MARK: - properties + enum HTTPMethod: String { + case get = "GET" + case post = "POST" + } + + var gigs: [Gig] = [] + + enum NetworkError: Error { + case failedSignUp, failedLogIn, noData, badData + case notSignedIn, failedFetch, failedPost + } + + enum LogInStatus { + case notLoggedIn + case loggedIn + } + + var bearer: Bearer? + + private var baseURL = URL(string: "https://lambdagigapi.herokuapp.com/api")! + private lazy var signUpURL: URL = baseURL.appendingPathComponent("/users/signup") + private lazy var logInURL: URL = baseURL.appendingPathComponent("/users/login") + private lazy var allGigsURL: URL = baseURL.appendingPathComponent("/gigs/") + + private lazy var jsonEncoder = JSONEncoder() + private lazy var jsonDecoder = JSONDecoder() + + private let contentValue = "application/json" + private let httpHeaderType = "Content-Type" + + // MARK: - sign up + func signUp(with user: User, completion: @escaping (NetworkError?) -> Void) { + print("signUpURL = \(signUpURL.absoluteString)") + + var request = URLRequest(url: signUpURL) + + request.httpMethod = HTTPMethod.post.rawValue + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + + do { + let jsonData = try jsonEncoder.encode(user) + request.httpBody = jsonData + + URLSession.shared.dataTask(with: request) { _, response, error in + if let error = error { + print("sign up failed with error: \(error)") + completion(.failedSignUp) + return + } + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 else { + print("sign up unsuccessful") + completion(.failedSignUp) + return + } + completion(nil) + }.resume() + } catch { + print("error encoding user object: \(error)") + completion(.failedSignUp) + return + } + } + + func logIn(with user: User, completion: @escaping (Result) -> Void) { + var request = URLRequest(url: logInURL) + request.httpMethod = HTTPMethod.post.rawValue + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + + do { + let jsonData = try jsonEncoder.encode(user) + request.httpBody = jsonData + } catch { + print("catch error decoding the data into the error token") + completion(.failure(.badData)) + return + } + + URLSession.shared.dataTask(with: request) { data, response, error in + if let error = error { + print("log in failed with error: \(error)") + return + } + + guard let response = response as? HTTPURLResponse, response.statusCode == 200 + else { + print("log in was not successful."); + completion(.failure(.failedLogIn)) + return + } + guard let data = data else { + print("no data was returned.") + completion(.failure(.noData)) + return + } + + do { + self.bearer = try self.jsonDecoder.decode(Bearer.self, from: data) + completion(.success(true)) + return + } catch { + print("error decoding bearer: \(error)") + completion(.failure(.failedLogIn)) + return + } + + }.resume() + } + + func fetchGigs(completion: @escaping (Result) -> Void) { + guard let bearer = bearer else { + completion(.failure(.notSignedIn)) + return + } + + let request = getRequest(for: allGigsURL, bearer: bearer) + + URLSession.shared.dataTask(with: request) { data, response, error in + if let error = error { + print("failed to fetch gigs: \(error)") + completion(.failure(.failedFetch)) + return + } + + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 + else { + print("Gig names received bad response") + completion(.failure(.failedFetch)) + return + } + + guard let data = data else { + completion(.failure(.badData)) + return + } + do { + let gigs = try self.jsonDecoder.decode([Gig].self, from: data) + self.gigs = gigs + completion(.success(true)) + } catch { + print("error decoding Gigs: \(error)") + completion(.failure(.badData)) + } + }.resume() + } + + func postGig(for gig: Gig, completion: @escaping (Result) -> Void) { + guard let bearer = bearer else { + completion(.failure(.notSignedIn)) + return + } + + let request = gigUrl(with: allGigsURL, with: bearer, requestType: .post) + + URLSession.shared.dataTask(with: request) { data, response, error in + if let error = error { + print("gig failed to post. error: \(error)") + completion(.failure(.failedFetch)) + return + } + + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 + else { + print("gig received non-200 response") + completion(.failure(.failedFetch)) + return + } + + guard let data = data else { + return completion(.failure(.badData)) + } + + do { + let gig = try self.jsonDecoder.decode([Gig].self, from: data) + completion(.success(true)) + self.gigs.append(contentsOf: gig) + } catch { + print("error decoding gig: \(error)") + completion(.failure(.failedPost)) + } + }.resume() + + } + + private func getRequest(for url: URL, bearer: Bearer) -> URLRequest { + var request = URLRequest(url: url) + request.addValue("Bearer \(bearer.token)", forHTTPHeaderField: "Authorization") + return request + } + + private func gigUrl(with url: URL, with bearer: Bearer, requestType: HTTPMethod) -> URLRequest { + var request = URLRequest(url: url) + request.httpMethod = requestType.rawValue + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + request.addValue("Bearer \(bearer.token)", forHTTPHeaderField: "Authorization") + return request + } +}