diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..d266e60b Binary files /dev/null and b/.DS_Store differ diff --git a/Gigs/.DS_Store b/Gigs/.DS_Store new file mode 100644 index 00000000..2a746554 Binary files /dev/null and b/Gigs/.DS_Store differ diff --git a/Gigs/Gigs.xcodeproj/project.pbxproj b/Gigs/Gigs.xcodeproj/project.pbxproj new file mode 100644 index 00000000..4fe85f7a --- /dev/null +++ b/Gigs/Gigs.xcodeproj/project.pbxproj @@ -0,0 +1,399 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + CA135E6124670DD000BA6961 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E6024670DD000BA6961 /* AppDelegate.swift */; }; + CA135E6324670DD000BA6961 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E6224670DD000BA6961 /* SceneDelegate.swift */; }; + CA135E6824670DD000BA6961 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CA135E6624670DD000BA6961 /* Main.storyboard */; }; + CA135E6A24670DD300BA6961 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CA135E6924670DD300BA6961 /* Assets.xcassets */; }; + CA135E6D24670DD300BA6961 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CA135E6B24670DD300BA6961 /* LaunchScreen.storyboard */; }; + CA135E7524670E9900BA6961 /* GigsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E7424670E9900BA6961 /* GigsTableViewController.swift */; }; + CA135E772467119200BA6961 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E762467119200BA6961 /* LoginViewController.swift */; }; + CA135E79246712C900BA6961 /* Bearer.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E78246712C900BA6961 /* Bearer.swift */; }; + CA135E7B2467130900BA6961 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E7A2467130900BA6961 /* User.swift */; }; + CA135E7D2467135000BA6961 /* GigController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135E7C2467135000BA6961 /* GigController.swift */; }; + CA135ECE246B874800BA6961 /* GigDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135ECD246B874800BA6961 /* GigDetailViewController.swift */; }; + CA135ED0246B87F800BA6961 /* Gig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA135ECF246B87F800BA6961 /* Gig.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + CA135E5D24670DD000BA6961 /* Gigs.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Gigs.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CA135E6024670DD000BA6961 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + CA135E6224670DD000BA6961 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + CA135E6724670DD000BA6961 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + CA135E6924670DD300BA6961 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + CA135E6C24670DD300BA6961 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + CA135E6E24670DD300BA6961 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CA135E7424670E9900BA6961 /* GigsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigsTableViewController.swift; sourceTree = ""; }; + CA135E762467119200BA6961 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; + CA135E78246712C900BA6961 /* Bearer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bearer.swift; sourceTree = ""; }; + CA135E7A2467130900BA6961 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + CA135E7C2467135000BA6961 /* GigController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigController.swift; sourceTree = ""; }; + CA135ECD246B874800BA6961 /* GigDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigDetailViewController.swift; sourceTree = ""; }; + CA135ECF246B87F800BA6961 /* Gig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Gig.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CA135E5A24670DD000BA6961 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + CA135E5424670DCF00BA6961 = { + isa = PBXGroup; + children = ( + CA135E5F24670DD000BA6961 /* Gigs */, + CA135E5E24670DD000BA6961 /* Products */, + ); + sourceTree = ""; + }; + CA135E5E24670DD000BA6961 /* Products */ = { + isa = PBXGroup; + children = ( + CA135E5D24670DD000BA6961 /* Gigs.app */, + ); + name = Products; + sourceTree = ""; + }; + CA135E5F24670DD000BA6961 /* Gigs */ = { + isa = PBXGroup; + children = ( + CA135E8124671F6D00BA6961 /* Application */, + CA135E8024671F1C00BA6961 /* Models */, + CA135E7F24671F1500BA6961 /* Controllers */, + CA135E7E24671F1000BA6961 /* Views */, + CA135E6924670DD300BA6961 /* Assets.xcassets */, + CA135E6E24670DD300BA6961 /* Info.plist */, + ); + path = Gigs; + sourceTree = ""; + }; + CA135E7E24671F1000BA6961 /* Views */ = { + isa = PBXGroup; + children = ( + CA135E6B24670DD300BA6961 /* LaunchScreen.storyboard */, + CA135E6624670DD000BA6961 /* Main.storyboard */, + ); + path = Views; + sourceTree = ""; + }; + CA135E7F24671F1500BA6961 /* Controllers */ = { + isa = PBXGroup; + children = ( + CA135E7C2467135000BA6961 /* GigController.swift */, + CA135E7424670E9900BA6961 /* GigsTableViewController.swift */, + CA135E762467119200BA6961 /* LoginViewController.swift */, + CA135ECD246B874800BA6961 /* GigDetailViewController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + CA135E8024671F1C00BA6961 /* Models */ = { + isa = PBXGroup; + children = ( + CA135E7A2467130900BA6961 /* User.swift */, + CA135E78246712C900BA6961 /* Bearer.swift */, + CA135ECF246B87F800BA6961 /* Gig.swift */, + ); + path = Models; + sourceTree = ""; + }; + CA135E8124671F6D00BA6961 /* Application */ = { + isa = PBXGroup; + children = ( + CA135E6024670DD000BA6961 /* AppDelegate.swift */, + CA135E6224670DD000BA6961 /* SceneDelegate.swift */, + ); + path = Application; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CA135E5C24670DD000BA6961 /* Gigs */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA135E7124670DD300BA6961 /* Build configuration list for PBXNativeTarget "Gigs" */; + buildPhases = ( + CA135E5924670DD000BA6961 /* Sources */, + CA135E5A24670DD000BA6961 /* Frameworks */, + CA135E5B24670DD000BA6961 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Gigs; + productName = Gigs; + productReference = CA135E5D24670DD000BA6961 /* Gigs.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CA135E5524670DCF00BA6961 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1100; + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = "Bohdan Tkachenko"; + TargetAttributes = { + CA135E5C24670DD000BA6961 = { + CreatedOnToolsVersion = 11.0; + }; + }; + }; + buildConfigurationList = CA135E5824670DCF00BA6961 /* Build configuration list for PBXProject "Gigs" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CA135E5424670DCF00BA6961; + productRefGroup = CA135E5E24670DD000BA6961 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CA135E5C24670DD000BA6961 /* Gigs */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CA135E5B24670DD000BA6961 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA135E6D24670DD300BA6961 /* LaunchScreen.storyboard in Resources */, + CA135E6A24670DD300BA6961 /* Assets.xcassets in Resources */, + CA135E6824670DD000BA6961 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CA135E5924670DD000BA6961 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA135E7D2467135000BA6961 /* GigController.swift in Sources */, + CA135ECE246B874800BA6961 /* GigDetailViewController.swift in Sources */, + CA135E7524670E9900BA6961 /* GigsTableViewController.swift in Sources */, + CA135E79246712C900BA6961 /* Bearer.swift in Sources */, + CA135E6124670DD000BA6961 /* AppDelegate.swift in Sources */, + CA135E772467119200BA6961 /* LoginViewController.swift in Sources */, + CA135E6324670DD000BA6961 /* SceneDelegate.swift in Sources */, + CA135E7B2467130900BA6961 /* User.swift in Sources */, + CA135ED0246B87F800BA6961 /* Gig.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + CA135E6624670DD000BA6961 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CA135E6724670DD000BA6961 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + CA135E6B24670DD300BA6961 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CA135E6C24670DD300BA6961 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + CA135E6F24670DD300BA6961 /* 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.0; + 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; + }; + CA135E7024670DD300BA6961 /* 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.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + CA135E7224670DD300BA6961 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = M54A7BX79B; + INFOPLIST_FILE = Gigs/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.bohdantkachenko.Gigs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + CA135E7324670DD300BA6961 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = M54A7BX79B; + INFOPLIST_FILE = Gigs/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.bohdantkachenko.Gigs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CA135E5824670DCF00BA6961 /* Build configuration list for PBXProject "Gigs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA135E6F24670DD300BA6961 /* Debug */, + CA135E7024670DD300BA6961 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CA135E7124670DD300BA6961 /* Build configuration list for PBXNativeTarget "Gigs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA135E7224670DD300BA6961 /* Debug */, + CA135E7324670DD300BA6961 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CA135E5524670DCF00BA6961 /* 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..d19207e8 --- /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/bohdantkachenko.xcuserdatad/UserInterfaceState.xcuserstate b/Gigs/Gigs.xcodeproj/project.xcworkspace/xcuserdata/bohdantkachenko.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..f9d13cdf Binary files /dev/null and b/Gigs/Gigs.xcodeproj/project.xcworkspace/xcuserdata/bohdantkachenko.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Gigs/Gigs.xcodeproj/xcuserdata/bohdantkachenko.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Gigs/Gigs.xcodeproj/xcuserdata/bohdantkachenko.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 00000000..1c6432b2 --- /dev/null +++ b/Gigs/Gigs.xcodeproj/xcuserdata/bohdantkachenko.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/Gigs/Gigs.xcodeproj/xcuserdata/bohdantkachenko.xcuserdatad/xcschemes/xcschememanagement.plist b/Gigs/Gigs.xcodeproj/xcuserdata/bohdantkachenko.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..ac50f444 --- /dev/null +++ b/Gigs/Gigs.xcodeproj/xcuserdata/bohdantkachenko.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Gigs.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Gigs/Gigs/Application/AppDelegate.swift b/Gigs/Gigs/Application/AppDelegate.swift new file mode 100644 index 00000000..d8c1ba50 --- /dev/null +++ b/Gigs/Gigs/Application/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. 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/Application/SceneDelegate.swift b/Gigs/Gigs/Application/SceneDelegate.swift new file mode 100644 index 00000000..cf79edd5 --- /dev/null +++ b/Gigs/Gigs/Application/SceneDelegate.swift @@ -0,0 +1,53 @@ +// +// SceneDelegate.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. 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/Assets.xcassets/AppIcon.appiconset/Contents.json b/Gigs/Gigs/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/Gigs/Gigs/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Gigs/Gigs/Assets.xcassets/Contents.json b/Gigs/Gigs/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Gigs/Gigs/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Gigs/Gigs/Controllers/GigController.swift b/Gigs/Gigs/Controllers/GigController.swift new file mode 100644 index 00000000..65f8ff7c --- /dev/null +++ b/Gigs/Gigs/Controllers/GigController.swift @@ -0,0 +1,236 @@ +// +// GigController.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import Foundation + + +final class GigController { + + var gigs: [Gig] = [] + + enum HTTPMethod: String { + case get = "GET" + case post = "POST" + } + + enum NetworkError: Error { + case noData, failedSignUp, failedSignIn, noToken, tryAgain, decodigError + } + + + private let baseURL = URL(string: "https://lambdaanimalspotter.herokuapp.com/api")! + private lazy var signUpURL = baseURL.appendingPathComponent("/users/signup") + private lazy var signInURL = baseURL.appendingPathComponent("/users/login") + private lazy var allGigsURL = baseURL.appendingPathComponent("/gigs/") + var bearer: Bearer? + + func signUp(with user: User, completion: @escaping (Result) -> Void) { + print("signUpURL = \(signUpURL.absoluteString)") + + var request = postRequest(for: signUpURL) + + do { + let encoder = JSONEncoder() + encoder.outputFormatting = .prettyPrinted + let jsonData = try encoder.encode(user) + print(String(data: jsonData, encoding: .utf8)!) + request.httpBody = jsonData + + let task = URLSession.shared.dataTask(with: request) { (_, response, error) in + // Check for error first + if let error = error { + print("Sign up failed with error: \(error)") + completion(.failure(.failedSignUp)) + return + } + + // Check for response and make sure it is a 200 + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 else { + print("Sign up was unsuccessful") + completion(.failure(.failedSignUp)) + return + } + + completion(.success(true)) + } + task.resume() + } catch { + print("Error encoding user: \(error)") + completion(.failure(.failedSignUp)) + } + } + + + func signIn(with user: User, completion: @escaping (Result) -> Void) { + + var request = postRequest(for: signInURL) + + do { + let encoder = JSONEncoder() + let jsonData = try encoder.encode(user) + request.httpBody = jsonData + + URLSession.shared.dataTask(with: request) { (data, response, error) in + // Handle Error + if let error = error { + print("Sign in failed with error \(error)") + completion(.failure(.failedSignIn)) + return + } + + // Handle Response + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 else { + print("Sign in was unsuccessful") + completion(.failure(.failedSignIn)) + return + } + + // Handle Data + guard let data = data else { + print("Data was not received") + completion(.failure(.noData)) + return + } + + do { + let decoder = JSONDecoder() + self.bearer = try decoder.decode(Bearer.self, from: data) + print(self.bearer!) + completion(.success(true)) + } catch { + print("Error decoding bearer: \(error)") + completion(.failure(.noToken)) + return + } + }.resume() + } catch { + print("Error encoding user: \(error)") + completion(.failure(.failedSignIn)) + } + } + + //Fetch all gig + func fetchGig(completion: @escaping (Result) -> Void) { + guard let bearer = self.bearer else { + completion(.failure(.noToken)) + return + } + var request = URLRequest(url: allGigsURL) + request.httpMethod = HTTPMethod.get.rawValue + request.setValue("Bearer \(bearer.token)", forHTTPHeaderField: "Authorization") + + let task = URLSession.shared.dataTask(with: request) { (data, response, error) in + + + guard error == nil else { + completion(.failure(.tryAgain)) + return + } + + if let response = response as? HTTPURLResponse, + response.statusCode == 401 { + completion(.failure(.noToken)) + return + } + + guard let data = data else { + completion(.failure(.noData)) + return + } + + let decoder = JSONDecoder() + let serial = try? JSONSerialization.jsonObject(with: data, options: []) + print(serial) + decoder.dateDecodingStrategy = .iso8601 + + do { + let newGigs = try decoder.decode([Gig].self, from: data) + //request.httpBody = newGigs + completion(.success(true)) + self.gigs = newGigs + } catch { + completion(.failure(.decodigError)) + return + } + } + task.resume() + } + + func createGig(with gig: Gig, completion: @escaping (Result) -> Void) { + guard let bearer = self.bearer else { + completion(.failure(.noToken)) + return + } + var request = URLRequest(url: allGigsURL) + request.httpMethod = HTTPMethod.post.rawValue + request.setValue("Bearer \(bearer.token)", forHTTPHeaderField: "Authorization") + request.addValue("application/json", forHTTPHeaderField: "Content-Type") + + let encoder = JSONEncoder() + encoder.dateEncodingStrategy = .iso8601 + + do { + let jsonData = try encoder.encode(gig) + request.httpBody = jsonData + print(String(data: jsonData, encoding: .utf8)!) + + } catch { + print("Error encoding gig: \(error)") + completion(.failure(.tryAgain)) + + } + let task = URLSession.shared.dataTask(with: request) { (_, response, error) in + + // Check for error first + if let error = error { + print("CreateGig failed with error: \(error)") + completion(.failure(.tryAgain)) + return + } + + // Check for response and make sure it is a 200 + if let response = response as? HTTPURLResponse, + response.statusCode == 401 { + completion(.failure(.noToken)) + return + } + +// guard let data = data else { +// print("No data received from createGig") +// completion(.failure(.noData)) +// return +// } +// let decoder = JSONDecoder() +// decoder.dateDecodingStrategy = .iso8601 +// +// do { +// let gigs = try decoder.decode([Gig].self, from: data) +// self.gigs.append(contentsOf: gigs) +// completion(.success(true)) +// } catch { +// completion(.failure(.tryAgain)) +// return +// } + self.gigs.append(gig) + completion(.success(true)) + } + task.resume() + + } + + + + private func postRequest(for url: URL) -> URLRequest { + var request = URLRequest(url: url) + request.httpMethod = HTTPMethod.post.rawValue + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + return request + } +} diff --git a/Gigs/Gigs/Controllers/GigDetailViewController.swift b/Gigs/Gigs/Controllers/GigDetailViewController.swift new file mode 100644 index 00000000..43188b22 --- /dev/null +++ b/Gigs/Gigs/Controllers/GigDetailViewController.swift @@ -0,0 +1,67 @@ +// +// GigDetailViewController.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/12/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import UIKit + +class GigDetailViewController: UIViewController { + + @IBOutlet var descriptionTextView: UITextView! + @IBOutlet var dueDatePicker: UIDatePicker! + @IBOutlet var jobTitleTextField: UITextField! + + var gigController: GigController! + var gig: Gig? + + override func viewDidLoad() { + super.viewDidLoad() + + updateViews() + + } + + + @IBAction func saveButtonTapped(_ sender: UIBarButtonItem) { + guard let jobTitle = jobTitleTextField.text, + !jobTitleTextField.text!.isEmpty, + let gigController = gigController, + let descriptionGig = descriptionTextView.text, + !descriptionTextView.text.isEmpty else { return } + let dueDate = dueDatePicker.date + + let newGig = Gig(title: jobTitle, dueDate: dueDate, description: descriptionGig) + + + gigController.createGig(with: newGig) { (result) in + guard (try? result.get()) != nil else { return} + do { + let success = try result.get() + if success { + DispatchQueue.main.async { + self.navigationController?.popToRootViewController(animated: true) + } + } + } catch { + print("Could not create a new gig: \(error)") + + } + } + } + + + func updateViews() { + if let gig = gig { + self.title = gig.title + descriptionTextView.text = gig.description + dueDatePicker.date = gig.dueDate + jobTitleTextField.text = gig.title + } else { + self.title = "New Title" + } + } + +} diff --git a/Gigs/Gigs/Controllers/GigsTableViewController.swift b/Gigs/Gigs/Controllers/GigsTableViewController.swift new file mode 100644 index 00000000..845fa00b --- /dev/null +++ b/Gigs/Gigs/Controllers/GigsTableViewController.swift @@ -0,0 +1,93 @@ +// +// GigsTableViewController.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import UIKit + +class GigsTableViewController: UITableViewController { + + var gigController: GigController = GigController() + let formatter = DateFormatter() + + override func viewDidLoad() { + super.viewDidLoad() + + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + + if gigController.bearer == nil { + performSegue(withIdentifier: "ToLogInScreen", sender: self) + } else { + gigController.fetchGig { (result) in + do { + let success = try result.get() + if success { + DispatchQueue.main.async { + print("Successfully fetched all gigs") + self.tableView.reloadData() + } + } + } catch { + print("Unable to create new gig with \(error)") + } + } + } + } + + + // MARK: - Table view data source + + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return gigController.gigs.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "GigCell", for: indexPath) + let gigName = gigController.gigs[indexPath.row] + cell.textLabel?.text = gigName.title + formatter.dateStyle = .short + formatter.timeStyle = .short + cell.detailTextLabel?.text = formatter.string(from: gigName.dueDate) + // cell.textLabel?.text = gigNames[indexPath.row] + + return cell + } + + + + + // MARK: - Navigation + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "ToLogInScreen" { + if let loginVC = segue.destination as? LoginViewController { + loginVC.gigController = gigController + } + } + if segue.identifier == "AddGig" { + if let gigDetail = segue.destination as? GigDetailViewController { + gigDetail.gigController = gigController + } + } + if segue.identifier == "ShowGig" { + guard let showGig = segue.destination as? GigDetailViewController else { return } + guard let indexPath = tableView.indexPathForSelectedRow else { return } + showGig.gig = gigController.gigs[indexPath.row] + showGig.gigController = gigController + } + } +} + + + diff --git a/Gigs/Gigs/Controllers/LoginViewController.swift b/Gigs/Gigs/Controllers/LoginViewController.swift new file mode 100644 index 00000000..b9ecec5b --- /dev/null +++ b/Gigs/Gigs/Controllers/LoginViewController.swift @@ -0,0 +1,101 @@ +// +// LoginViewController.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import UIKit + +enum LoginType { + case signUp + case signIn +} + +class LoginViewController: UIViewController { + + var gigController: GigController? + var loginType = LoginType.signUp + + @IBOutlet var loginTypeSegmentedController: UISegmentedControl! + @IBOutlet var usernametextField: UITextField! + @IBOutlet var passwordTextField: UITextField! + @IBOutlet var signInButton: UIButton! + + + + + + override func viewDidLoad() { + super.viewDidLoad() + } + + + @IBAction func buttonPressed(_ sender: UIButton) { + if let username = usernametextField.text, + !username.isEmpty, + let password = passwordTextField.text, + !password.isEmpty { + let user = User(username: username, password: password) + if loginType == .signUp { + gigController?.signUp(with: user, completion: { (result) in + do { + let success = try result.get() + if success { + DispatchQueue.main.async { + let alertController = UIAlertController(title: "Sign Up Successful", message: "Now please log in.", preferredStyle: .alert) + let alertAction = UIAlertAction(title: "Ok", style: .default, handler: nil) + alertController.addAction(alertAction) + self.present(alertController, animated: true) { + self.loginType = .signIn + self.loginTypeSegmentedController.selectedSegmentIndex = 1 + self.signInButton.setTitle("Sign In", for: .normal) + self.signInButton.setTitleColor(.green, for: .normal) + } + } + } + } catch { + print("Error signing up: \(error)") + } + }) + } else { + gigController?.signIn(with: user, completion: { (result) in + do { + let success = try result.get() + if success { + DispatchQueue.main.async { + self.dismiss(animated: true, completion: nil) + } + } + } catch { + if let error = error as? GigController.NetworkError { + switch error { + case .failedSignIn: + print("Sign in failed") + case .noToken, .noData: + print("No data received") + default: + print("Other error occurred") + } + } + } + }) + } + } + + } + + + + @IBAction func signinTypeChanged(_ sender: UISegmentedControl) { + if sender.selectedSegmentIndex == 0 { + loginType = .signUp + signInButton.setTitle("Sign Up", for: .normal) + } else { + loginType = .signIn + signInButton.setTitle("Sign In", for: .normal) + } + } + +} 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/Models/Bearer.swift b/Gigs/Gigs/Models/Bearer.swift new file mode 100644 index 00000000..75ff02ad --- /dev/null +++ b/Gigs/Gigs/Models/Bearer.swift @@ -0,0 +1,14 @@ +// +// Bearer.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import Foundation + + +struct Bearer: Codable { + let token: String +} diff --git a/Gigs/Gigs/Models/Gig.swift b/Gigs/Gigs/Models/Gig.swift new file mode 100644 index 00000000..8754fd89 --- /dev/null +++ b/Gigs/Gigs/Models/Gig.swift @@ -0,0 +1,16 @@ +// +// Gig.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/12/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import Foundation + + +struct Gig: Codable { + var title: String + var dueDate: Date + var description: String +} diff --git a/Gigs/Gigs/Models/User.swift b/Gigs/Gigs/Models/User.swift new file mode 100644 index 00000000..03127766 --- /dev/null +++ b/Gigs/Gigs/Models/User.swift @@ -0,0 +1,15 @@ +// +// User.swift +// Gigs +// +// Created by Bohdan Tkachenko on 5/9/20. +// Copyright © 2020 Bohdan Tkachenko. All rights reserved. +// + +import Foundation + + +struct User: Codable { + let username: String + let password: String +} diff --git a/Gigs/Gigs/Views/Base.lproj/LaunchScreen.storyboard b/Gigs/Gigs/Views/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/Gigs/Gigs/Views/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gigs/Gigs/Views/Base.lproj/Main.storyboard b/Gigs/Gigs/Views/Base.lproj/Main.storyboard new file mode 100644 index 00000000..c24dfa74 --- /dev/null +++ b/Gigs/Gigs/Views/Base.lproj/Main.storyboard @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +