diff --git a/Experiences/Experiences.xcodeproj/project.pbxproj b/Experiences/Experiences.xcodeproj/project.pbxproj new file mode 100644 index 00000000..45df8a12 --- /dev/null +++ b/Experiences/Experiences.xcodeproj/project.pbxproj @@ -0,0 +1,371 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 5132C464250C59370003F964 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132C463250C59370003F964 /* AppDelegate.swift */; }; + 5132C466250C59370003F964 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132C465250C59370003F964 /* SceneDelegate.swift */; }; + 5132C46B250C59370003F964 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5132C469250C59370003F964 /* Main.storyboard */; }; + 5132C46D250C59390003F964 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5132C46C250C59390003F964 /* Assets.xcassets */; }; + 5132C470250C59390003F964 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5132C46E250C59390003F964 /* LaunchScreen.storyboard */; }; + 5132C47A250C5A790003F964 /* Experience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132C479250C5A790003F964 /* Experience.swift */; }; + 5132C47C250C5AA70003F964 /* ExperiencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132C47B250C5AA70003F964 /* ExperiencesViewController.swift */; }; + 5132C47E250C5ABD0003F964 /* NewExperienceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132C47D250C5ABD0003F964 /* NewExperienceViewController.swift */; }; + 5132C480250C5E4E0003F964 /* UIImage+Scaling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5132C47F250C5E4E0003F964 /* UIImage+Scaling.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 5132C460250C59370003F964 /* Experiences.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Experiences.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 5132C463250C59370003F964 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 5132C465250C59370003F964 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 5132C46A250C59370003F964 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 5132C46C250C59390003F964 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 5132C46F250C59390003F964 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 5132C471250C59390003F964 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5132C479250C5A790003F964 /* Experience.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Experience.swift; sourceTree = ""; }; + 5132C47B250C5AA70003F964 /* ExperiencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExperiencesViewController.swift; sourceTree = ""; }; + 5132C47D250C5ABD0003F964 /* NewExperienceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewExperienceViewController.swift; sourceTree = ""; }; + 5132C47F250C5E4E0003F964 /* UIImage+Scaling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Scaling.swift"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5132C45D250C59370003F964 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5132C457250C59370003F964 = { + isa = PBXGroup; + children = ( + 5132C462250C59370003F964 /* Experiences */, + 5132C461250C59370003F964 /* Products */, + ); + sourceTree = ""; + }; + 5132C461250C59370003F964 /* Products */ = { + isa = PBXGroup; + children = ( + 5132C460250C59370003F964 /* Experiences.app */, + ); + name = Products; + sourceTree = ""; + }; + 5132C462250C59370003F964 /* Experiences */ = { + isa = PBXGroup; + children = ( + 5132C478250C5A670003F964 /* Controllers */, + 5132C477250C5A5F0003F964 /* Model */, + 5132C463250C59370003F964 /* AppDelegate.swift */, + 5132C465250C59370003F964 /* SceneDelegate.swift */, + 5132C469250C59370003F964 /* Main.storyboard */, + 5132C46C250C59390003F964 /* Assets.xcassets */, + 5132C46E250C59390003F964 /* LaunchScreen.storyboard */, + 5132C471250C59390003F964 /* Info.plist */, + ); + path = Experiences; + sourceTree = ""; + }; + 5132C477250C5A5F0003F964 /* Model */ = { + isa = PBXGroup; + children = ( + 5132C479250C5A790003F964 /* Experience.swift */, + 5132C47F250C5E4E0003F964 /* UIImage+Scaling.swift */, + ); + path = Model; + sourceTree = ""; + }; + 5132C478250C5A670003F964 /* Controllers */ = { + isa = PBXGroup; + children = ( + 5132C47B250C5AA70003F964 /* ExperiencesViewController.swift */, + 5132C47D250C5ABD0003F964 /* NewExperienceViewController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5132C45F250C59370003F964 /* Experiences */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5132C474250C59390003F964 /* Build configuration list for PBXNativeTarget "Experiences" */; + buildPhases = ( + 5132C45C250C59370003F964 /* Sources */, + 5132C45D250C59370003F964 /* Frameworks */, + 5132C45E250C59370003F964 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Experiences; + productName = Experiences; + productReference = 5132C460250C59370003F964 /* Experiences.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5132C458250C59370003F964 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1170; + LastUpgradeCheck = 1170; + ORGANIZATIONNAME = "Josh Kocsis"; + TargetAttributes = { + 5132C45F250C59370003F964 = { + CreatedOnToolsVersion = 11.7; + }; + }; + }; + buildConfigurationList = 5132C45B250C59370003F964 /* Build configuration list for PBXProject "Experiences" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 5132C457250C59370003F964; + productRefGroup = 5132C461250C59370003F964 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5132C45F250C59370003F964 /* Experiences */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 5132C45E250C59370003F964 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5132C470250C59390003F964 /* LaunchScreen.storyboard in Resources */, + 5132C46D250C59390003F964 /* Assets.xcassets in Resources */, + 5132C46B250C59370003F964 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 5132C45C250C59370003F964 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5132C47C250C5AA70003F964 /* ExperiencesViewController.swift in Sources */, + 5132C47A250C5A790003F964 /* Experience.swift in Sources */, + 5132C464250C59370003F964 /* AppDelegate.swift in Sources */, + 5132C480250C5E4E0003F964 /* UIImage+Scaling.swift in Sources */, + 5132C47E250C5ABD0003F964 /* NewExperienceViewController.swift in Sources */, + 5132C466250C59370003F964 /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 5132C469250C59370003F964 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 5132C46A250C59370003F964 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 5132C46E250C59390003F964 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 5132C46F250C59390003F964 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 5132C472250C59390003F964 /* 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.7; + 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; + }; + 5132C473250C59390003F964 /* 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.7; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 5132C475250C59390003F964 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = HMX25T49H2; + INFOPLIST_FILE = Experiences/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = jkGames.Experiences; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 5132C476250C59390003F964 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = HMX25T49H2; + INFOPLIST_FILE = Experiences/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = jkGames.Experiences; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5132C45B250C59370003F964 /* Build configuration list for PBXProject "Experiences" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5132C472250C59390003F964 /* Debug */, + 5132C473250C59390003F964 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5132C474250C59390003F964 /* Build configuration list for PBXNativeTarget "Experiences" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5132C475250C59390003F964 /* Debug */, + 5132C476250C59390003F964 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5132C458250C59370003F964 /* Project object */; +} diff --git a/Experiences/Experiences/AppDelegate.swift b/Experiences/Experiences/AppDelegate.swift new file mode 100644 index 00000000..9514c0b0 --- /dev/null +++ b/Experiences/Experiences/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// Experiences +// +// Created by Josh Kocsis on 9/11/20. +// Copyright © 2020 Josh Kocsis. 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/Experiences/Experiences/Assets.xcassets/AppIcon.appiconset/Contents.json b/Experiences/Experiences/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/Experiences/Experiences/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/Experiences/Experiences/Assets.xcassets/Contents.json b/Experiences/Experiences/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-beach.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-beach.imageset/Contents.json new file mode 100644 index 00000000..ac27bd64 --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-beach.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-beach-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-beach.imageset/icons8-beach-50.png b/Experiences/Experiences/Assets.xcassets/icons8-beach.imageset/icons8-beach-50.png new file mode 100644 index 00000000..5ae914db Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-beach.imageset/icons8-beach-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-campsite.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-campsite.imageset/Contents.json new file mode 100644 index 00000000..fc60750a --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-campsite.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-campsite-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-campsite.imageset/icons8-campsite-50.png b/Experiences/Experiences/Assets.xcassets/icons8-campsite.imageset/icons8-campsite-50.png new file mode 100644 index 00000000..c9c6a9de Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-campsite.imageset/icons8-campsite-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-cave.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-cave.imageset/Contents.json new file mode 100644 index 00000000..8c6cf92d --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-cave.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-cave-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-cave.imageset/icons8-cave-50.png b/Experiences/Experiences/Assets.xcassets/icons8-cave.imageset/icons8-cave-50.png new file mode 100644 index 00000000..3b0bbf9f Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-cave.imageset/icons8-cave-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-cruise-ship.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-cruise-ship.imageset/Contents.json new file mode 100644 index 00000000..e9729d3f --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-cruise-ship.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-cruise-ship-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-cruise-ship.imageset/icons8-cruise-ship-50.png b/Experiences/Experiences/Assets.xcassets/icons8-cruise-ship.imageset/icons8-cruise-ship-50.png new file mode 100644 index 00000000..53fb6591 Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-cruise-ship.imageset/icons8-cruise-ship-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-fisherman-in-a-boat.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-fisherman-in-a-boat.imageset/Contents.json new file mode 100644 index 00000000..3933346b --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-fisherman-in-a-boat.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-fisherman-in-a-boat-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-fisherman-in-a-boat.imageset/icons8-fisherman-in-a-boat-50.png b/Experiences/Experiences/Assets.xcassets/icons8-fisherman-in-a-boat.imageset/icons8-fisherman-in-a-boat-50.png new file mode 100644 index 00000000..faef1dec Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-fisherman-in-a-boat.imageset/icons8-fisherman-in-a-boat-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-holiday.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-holiday.imageset/Contents.json new file mode 100644 index 00000000..42bb061d --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-holiday.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-holiday-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-holiday.imageset/icons8-holiday-50.png b/Experiences/Experiences/Assets.xcassets/icons8-holiday.imageset/icons8-holiday-50.png new file mode 100644 index 00000000..3fc6c066 Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-holiday.imageset/icons8-holiday-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-hotel-building.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-hotel-building.imageset/Contents.json new file mode 100644 index 00000000..e08f3a87 --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-hotel-building.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-hotel-building-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-hotel-building.imageset/icons8-hotel-building-50.png b/Experiences/Experiences/Assets.xcassets/icons8-hotel-building.imageset/icons8-hotel-building-50.png new file mode 100644 index 00000000..cecc2d45 Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-hotel-building.imageset/icons8-hotel-building-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-new.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-new.imageset/Contents.json new file mode 100644 index 00000000..25c37608 --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-new.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-new-48.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-new.imageset/icons8-new-48.png b/Experiences/Experiences/Assets.xcassets/icons8-new.imageset/icons8-new-48.png new file mode 100644 index 00000000..dac4ecca Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-new.imageset/icons8-new-48.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-scuba-diving.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-scuba-diving.imageset/Contents.json new file mode 100644 index 00000000..5f05fd64 --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-scuba-diving.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-scuba-diving-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-scuba-diving.imageset/icons8-scuba-diving-50.png b/Experiences/Experiences/Assets.xcassets/icons8-scuba-diving.imageset/icons8-scuba-diving-50.png new file mode 100644 index 00000000..67b6fa97 Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-scuba-diving.imageset/icons8-scuba-diving-50.png differ diff --git a/Experiences/Experiences/Assets.xcassets/icons8-zipline.imageset/Contents.json b/Experiences/Experiences/Assets.xcassets/icons8-zipline.imageset/Contents.json new file mode 100644 index 00000000..652d2979 --- /dev/null +++ b/Experiences/Experiences/Assets.xcassets/icons8-zipline.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icons8-zipline-50.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Experiences/Experiences/Assets.xcassets/icons8-zipline.imageset/icons8-zipline-50.png b/Experiences/Experiences/Assets.xcassets/icons8-zipline.imageset/icons8-zipline-50.png new file mode 100644 index 00000000..09f0b622 Binary files /dev/null and b/Experiences/Experiences/Assets.xcassets/icons8-zipline.imageset/icons8-zipline-50.png differ diff --git a/Experiences/Experiences/Base.lproj/LaunchScreen.storyboard b/Experiences/Experiences/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/Experiences/Experiences/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Experiences/Experiences/Base.lproj/Main.storyboard b/Experiences/Experiences/Base.lproj/Main.storyboard new file mode 100644 index 00000000..3ae20bf2 --- /dev/null +++ b/Experiences/Experiences/Base.lproj/Main.storyboard @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Experiences/Experiences/Controllers/ExperiencesViewController.swift b/Experiences/Experiences/Controllers/ExperiencesViewController.swift new file mode 100644 index 00000000..d7027e37 --- /dev/null +++ b/Experiences/Experiences/Controllers/ExperiencesViewController.swift @@ -0,0 +1,88 @@ +// +// ExperiencesViewController.swift +// Experiences +// +// Created by Josh Kocsis on 9/11/20. +// Copyright © 2020 Josh Kocsis. All rights reserved. +// + +import UIKit +import MapKit + +class ExperiencesViewController: UIViewController { + @IBOutlet weak var mapView: MKMapView! + @IBOutlet weak var addExperienceButton: UIButton! + + private var userTrackingButton: MKUserTrackingButton! + private let locationManager = CLLocationManager() + var experiences: [Experience] = [] + + override func viewDidLoad() { + super.viewDidLoad() + configureMapView() + mapView.delegate = self + + locationManager.requestWhenInUseAuthorization() + locationManager.desiredAccuracy = kCLLocationAccuracyBest + locationManager.distanceFilter = kCLDistanceFilterNone + locationManager.startUpdatingLocation() + + mapView.showsUserLocation = true + + userTrackingButton = MKUserTrackingButton(mapView: mapView) + userTrackingButton.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(userTrackingButton) + + NSLayoutConstraint.activate([ + userTrackingButton.leadingAnchor.constraint(equalTo: mapView.leadingAnchor, constant: 20), + mapView.bottomAnchor.constraint(equalTo: userTrackingButton.bottomAnchor, constant: 20) + ]) + } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(true) + print(experiences) + mapView.addAnnotations(experiences) + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + switch segue.identifier { + case "NewExperience": + if let navigationVC = segue.destination as? UINavigationController { + let newExperienceVC = navigationVC.topViewController as! NewExperienceViewController + newExperienceVC.experience = experiences + newExperienceVC.experienceDelegate = self + } + default: + break + } + } +} + +extension ExperiencesViewController: MKMapViewDelegate { + func mapViewDidChangeVisibleRegion(_ mapView: MKMapView) { + + } + + private func configureMapView() { + mapView.register(MKMarkerAnnotationView.self, forAnnotationViewWithReuseIdentifier: .annotationReuseIdentifier) + mapView.addAnnotations(experiences) + } + + func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { + + guard let experience = annotation as? Experience else { return nil } + let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: .annotationReuseIdentifier, for: experience) as! MKMarkerAnnotationView + + annotationView.glyphImage = #imageLiteral(resourceName: "icons8-campsite") + + annotationView.canShowCallout = true + annotationView.rightCalloutAccessoryView = UIButton(type: .detailDisclosure) + return annotationView + } +} + +extension ExperiencesViewController: ExperienceDelegate { + func getExperience(experience: Experience) { + experiences.append(experience) + } +} diff --git a/Experiences/Experiences/Controllers/NewExperienceViewController.swift b/Experiences/Experiences/Controllers/NewExperienceViewController.swift new file mode 100644 index 00000000..5006a071 --- /dev/null +++ b/Experiences/Experiences/Controllers/NewExperienceViewController.swift @@ -0,0 +1,267 @@ +// +// NewExperienceViewController.swift +// Experiences +// +// Created by Josh Kocsis on 9/11/20. +// Copyright © 2020 Josh Kocsis. All rights reserved. +// + + +import UIKit +import CoreImage +import CoreImage.CIFilterBuiltins +import Photos +import AVFoundation +import MapKit +import CoreLocation + +extension String { + static let annotationReuseIdentifier = "Experiences" +} + +protocol ExperienceDelegate { + func getExperience(experience: Experience) +} + +class NewExperienceViewController: UIViewController { + @IBOutlet weak var titleTextField: UITextField! + @IBOutlet weak var newExperienceImageView: UIImageView! + @IBOutlet weak var audioRecordingButton: UIButton! + + var experience: [Experience] = [] + var experienceDelegate: ExperienceDelegate? + var audioPlayer: AVAudioPlayer? + var recordingURL: URL? + var audioRecorder: AVAudioRecorder? + private let locationManager = CLLocationManager() + + var originalImage: UIImage? { + didSet { + guard let originalImage = originalImage else { + scaledImage = nil + return + } + + var scaledSize = newExperienceImageView.bounds.size + let scale = newExperienceImageView.contentScaleFactor + + scaledSize.width *= scale + scaledSize.height *= scale + + guard let scaledUIImage = originalImage.imageByScaling(toSize: scaledSize) else { + scaledImage = nil + return + } + + scaledImage = CIImage(image: scaledUIImage) + } + } + + var scaledImage: CIImage? { + didSet { + updateImage() + } + } + + override func viewDidLoad() { + super.viewDidLoad() + originalImage = newExperienceImageView.image + audioRecordingButton.titleLabel?.text = "Record" + updateViews() + } + func prepareAudioSession() throws { + let session = AVAudioSession.sharedInstance() + try session.setCategory(.playAndRecord, options: [.defaultToSpeaker]) + try session.setActive(true, options: []) + } + + var isRecording: Bool { + audioRecorder?.isRecording ?? false + } + + func createNewRecordingURL() -> URL { + let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! + + let name = ISO8601DateFormatter.string(from: Date(), timeZone: .current, formatOptions: .withInternetDateTime) + let file = documents.appendingPathComponent(name, isDirectory: false).appendingPathExtension("caf") + + return file + } + + func requestPermissionOrStartRecording() { + switch AVAudioSession.sharedInstance().recordPermission { + case .undetermined: + AVAudioSession.sharedInstance().requestRecordPermission { granted in + guard granted == true else { + print("We need microphone access") + return + } + + print("Recording permission has been granted!") + + } + case .denied: + print("Microphone access has been blocked.") + + let alertController = UIAlertController(title: "Microphone Access Denied", message: "Please allow this app to access your Microphone.", preferredStyle: .alert) + + alertController.addAction(UIAlertAction(title: "Open Settings", style: .default) { (_) in + UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) + }) + + alertController.addAction(UIAlertAction(title: "Cancel", style: .default, handler: nil)) + + present(alertController, animated: true, completion: nil) + case .granted: + startRecording() + @unknown default: + break + } + } + + func startRecording() { + do { + try prepareAudioSession() + } catch { + print("Can't record audio: \(error)") + return + } + + recordingURL = createNewRecordingURL() + + let format = AVAudioFormat(standardFormatWithSampleRate: 44_100, channels: 1)! + + do { + audioRecorder = try AVAudioRecorder(url: recordingURL!, format: format) + audioRecorder?.delegate = self + audioRecorder?.isMeteringEnabled = true + audioRecorder?.record() + } catch { + preconditionFailure("The audio recorder could not be created with \(recordingURL!) and \(format)") + } + } + + func stopRecording() { + audioRecorder?.stop() + } + + func updateViews() { + audioRecordingButton.setTitle(isRecording.self ? "Stop Recording" : "Record", for: .normal) + if isRecording { + stopRecording() + } else { + requestPermissionOrStartRecording() + } + } + + private func showImagePickerControllerActionSheet() { + let alert = UIAlertController() + + let photoLibraryAction = UIAlertAction(title: "Choose from Library", style: .default) { (action) in + self.presentImagePickerController(sourceType: .photoLibrary) + } + + let cameraAction = UIAlertAction(title: "Camera", style: .default) { (action) in + self.presentImagePickerController(sourceType: .camera) + } + + let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) + + alert.addAction(photoLibraryAction) + alert.addAction(cameraAction) + alert.addAction(cancelAction) + + self.present(alert, animated: true) + + } + + private func presentImagePickerController(sourceType: UIImagePickerController.SourceType) { + guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else { + print("The photo library is not available.") + return + } + + let imagePicker = UIImagePickerController() + imagePicker.sourceType = sourceType + imagePicker.delegate = self + + present(imagePicker, animated: true, completion: nil) + } + + private func image(byFiltering inputImage: CIImage) -> UIImage? { + guard let currentCGImage = inputImage.cgImage else { return nil } + let currentCIImage = CIImage(cgImage: currentCGImage) + + let filter = CIFilter(name: "CIColorMonochrome") + filter?.setValue(currentCIImage, forKey: "inputImage") + + filter?.setValue(1.0, forKey: "inputIntensity") + guard let outputImage = filter?.outputImage else { return nil } + + let context = CIContext() + + let cgimg = context.createCGImage(outputImage, from: outputImage.extent)! + let processedImage = UIImage(cgImage: cgimg) + + return processedImage + } + + func updateImage() { + if let scaledImage = scaledImage { + newExperienceImageView.image = image(byFiltering: scaledImage) + } else { + newExperienceImageView.image = nil + } + } + + @IBAction func addImageTapped(_ sender: UIButton) { + showImagePickerControllerActionSheet() + } + + @IBAction func audioRecordingTapped(_ sender: UIButton) { + updateViews() + } + + @IBAction func saveButtonTapped(_ sender: UIBarButtonItem) { + let location = locationManager.location?.coordinate + + let newExperience = Experience(titleName: titleTextField.text ?? "", image: originalImage!, latitude: location!.latitude, longitude: location!.longitude) + experienceDelegate?.getExperience(experience: newExperience) + navigationController?.dismiss(animated: true, completion: nil) + } + +} + + +extension NewExperienceViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate { + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + + if let image = info[.editedImage] as? UIImage { + originalImage = image + } else if let image = info[.originalImage] as? UIImage { + originalImage = image + } + + picker.dismiss(animated: true, completion: nil) + } + + func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { + picker.dismiss(animated: true, completion: nil) + } +} + +extension NewExperienceViewController: AVAudioRecorderDelegate { + func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool) { + if let recordingURL = recordingURL { + audioPlayer = try? AVAudioPlayer(contentsOf: recordingURL) + } + recordingURL = nil + } + + func audioRecorderEncodeErrorDidOccur(_ recorder: AVAudioRecorder, error: Error?) { + if let error = error { + print("Audio Recorder Error: \(error)") + } + } +} diff --git a/Experiences/Experiences/Info.plist b/Experiences/Experiences/Info.plist new file mode 100644 index 00000000..f93cca05 --- /dev/null +++ b/Experiences/Experiences/Info.plist @@ -0,0 +1,70 @@ + + + + + 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 + NSPhotoLibraryUsageDescription + $(PRODUCT_NAME) needs access to post a picture of your experience. + NSLocationWhenInUseUsageDescription + $(PRODUCT_NAME) needs access so you can see your current location. + NSMicrophoneUsageDescription + $(PRODUCT_NAME) needs access to record audio for your experiences. + 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/Experiences/Experiences/Model/Experience.swift b/Experiences/Experiences/Model/Experience.swift new file mode 100644 index 00000000..0ba4c2eb --- /dev/null +++ b/Experiences/Experiences/Model/Experience.swift @@ -0,0 +1,33 @@ +// +// Experience.swift +// Experiences +// +// Created by Josh Kocsis on 9/11/20. +// Copyright © 2020 Josh Kocsis. All rights reserved. +// + +import Foundation +import UIKit +import MapKit + +class Experience: NSObject { + let titleName: String + let image: UIImage + let latitude: Double + let longitude: Double + + init(titleName: String, image: UIImage, latitude: Double, longitude: Double) { + self.titleName = titleName + self.image = image + self.latitude = latitude + self.longitude = longitude + } +} + +extension Experience: MKAnnotation { +var coordinate: CLLocationCoordinate2D { + CLLocationCoordinate2D(latitude: latitude, longitude: longitude) + } + + var title: String? { titleName } +} diff --git a/Experiences/Experiences/Model/UIImage+Scaling.swift b/Experiences/Experiences/Model/UIImage+Scaling.swift new file mode 100644 index 00000000..a1eb70e8 --- /dev/null +++ b/Experiences/Experiences/Model/UIImage+Scaling.swift @@ -0,0 +1,36 @@ +// +// UIImage+Scaling.swift +// Experiences +// +// Created by Josh Kocsis on 9/11/20. +// Copyright © 2020 Josh Kocsis. All rights reserved. +// + +import UIKit + +extension UIImage { + + func imageByScaling(toSize size: CGSize) -> UIImage? { + guard size.width > 0 && size.height > 0 else { return nil } + + let originalAspectRatio = self.size.width/self.size.height + var correctedSize = size + + if correctedSize.width > correctedSize.width*originalAspectRatio { + correctedSize.width = correctedSize.width*originalAspectRatio + } else { + correctedSize.height = correctedSize.height/originalAspectRatio + } + + return UIGraphicsImageRenderer(size: correctedSize, format: imageRendererFormat).image { context in + draw(in: CGRect(origin: .zero, size: correctedSize)) + } + } + + var flattened: UIImage { + if imageOrientation == .up { return self } + return UIGraphicsImageRenderer(size: size, format: imageRendererFormat).image { context in + draw(at: .zero) + } + } +} diff --git a/Experiences/Experiences/SceneDelegate.swift b/Experiences/Experiences/SceneDelegate.swift new file mode 100644 index 00000000..b5b0e5f8 --- /dev/null +++ b/Experiences/Experiences/SceneDelegate.swift @@ -0,0 +1,53 @@ +// +// SceneDelegate.swift +// Experiences +// +// Created by Josh Kocsis on 9/11/20. +// Copyright © 2020 Josh Kocsis. 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. + } + + +} +