diff --git a/Clima.xcodeproj/.xcodesamplecode.plist b/Clima.xcodeproj/.xcodesamplecode.plist new file mode 100644 index 0000000..5dd5da8 --- /dev/null +++ b/Clima.xcodeproj/.xcodesamplecode.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/Clima.xcodeproj/project.pbxproj b/Clima.xcodeproj/project.pbxproj new file mode 100644 index 0000000..af09cab --- /dev/null +++ b/Clima.xcodeproj/project.pbxproj @@ -0,0 +1,381 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 9438B8D32492DE2100B48867 /* WeatherManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9438B8D22492DE2100B48867 /* WeatherManager.swift */; }; + 94B460CE24941CB8006A2DBC /* WeatherData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94B460CD24941CB8006A2DBC /* WeatherData.swift */; }; + 94B460D024943438006A2DBC /* WeatherModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94B460CF24943438006A2DBC /* WeatherModel.swift */; }; + ADAA27B1231BBFAF00365194 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAA27B0231BBFAF00365194 /* AppDelegate.swift */; }; + ADAA27B3231BBFAF00365194 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAA27B2231BBFAF00365194 /* SceneDelegate.swift */; }; + ADAA27B5231BBFAF00365194 /* WeatherViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADAA27B4231BBFAF00365194 /* WeatherViewController.swift */; }; + ADAA27B8231BBFAF00365194 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ADAA27B6231BBFAF00365194 /* Main.storyboard */; }; + ADAA27BA231BBFB300365194 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADAA27B9231BBFB300365194 /* Assets.xcassets */; }; + ADAA27BD231BBFB300365194 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ADAA27BB231BBFB300365194 /* LaunchScreen.storyboard */; }; + ADAA27CE231BC87F00365194 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = ADAA27CD231BC87F00365194 /* README.md */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9438B8D22492DE2100B48867 /* WeatherManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WeatherManager.swift; path = Clima/WeatherManager.swift; sourceTree = SOURCE_ROOT; }; + 94B460CD24941CB8006A2DBC /* WeatherData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WeatherData.swift; path = Clima/WeatherData.swift; sourceTree = SOURCE_ROOT; }; + 94B460CF24943438006A2DBC /* WeatherModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WeatherModel.swift; path = Clima/WeatherModel.swift; sourceTree = SOURCE_ROOT; }; + ADAA27AD231BBFAF00365194 /* Clima.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Clima.app; sourceTree = BUILT_PRODUCTS_DIR; }; + ADAA27B0231BBFAF00365194 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + ADAA27B2231BBFAF00365194 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + ADAA27B4231BBFAF00365194 /* WeatherViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherViewController.swift; sourceTree = ""; }; + ADAA27B7231BBFAF00365194 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + ADAA27B9231BBFB300365194 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ADAA27BC231BBFB300365194 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + ADAA27BE231BBFB300365194 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + ADAA27CD231BC87F00365194 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + ADAA27AA231BBFAF00365194 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + ADAA27A4231BBFAF00365194 = { + isa = PBXGroup; + children = ( + ADAA27CD231BC87F00365194 /* README.md */, + ADAA27AF231BBFAF00365194 /* Clima */, + ADAA27AE231BBFAF00365194 /* Products */, + ); + sourceTree = ""; + }; + ADAA27AE231BBFAF00365194 /* Products */ = { + isa = PBXGroup; + children = ( + ADAA27AD231BBFAF00365194 /* Clima.app */, + ); + name = Products; + sourceTree = ""; + }; + ADAA27AF231BBFAF00365194 /* Clima */ = { + isa = PBXGroup; + children = ( + ADAA27B0231BBFAF00365194 /* AppDelegate.swift */, + ADAA27B2231BBFAF00365194 /* SceneDelegate.swift */, + ADAA27CA231BC3FA00365194 /* Model */, + ADAA27C9231BC3F200365194 /* View */, + ADAA27C8231BC3E500365194 /* Controller */, + ADAA27B9231BBFB300365194 /* Assets.xcassets */, + ADAA27BB231BBFB300365194 /* LaunchScreen.storyboard */, + ADAA27BE231BBFB300365194 /* Info.plist */, + ); + path = Clima; + sourceTree = ""; + }; + ADAA27C8231BC3E500365194 /* Controller */ = { + isa = PBXGroup; + children = ( + ADAA27B4231BBFAF00365194 /* WeatherViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + ADAA27C9231BC3F200365194 /* View */ = { + isa = PBXGroup; + children = ( + ADAA27B6231BBFAF00365194 /* Main.storyboard */, + ); + path = View; + sourceTree = ""; + }; + ADAA27CA231BC3FA00365194 /* Model */ = { + isa = PBXGroup; + children = ( + 9438B8D22492DE2100B48867 /* WeatherManager.swift */, + 94B460CD24941CB8006A2DBC /* WeatherData.swift */, + 94B460CF24943438006A2DBC /* WeatherModel.swift */, + ); + path = Model; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + ADAA27AC231BBFAF00365194 /* Clima */ = { + isa = PBXNativeTarget; + buildConfigurationList = ADAA27C1231BBFB300365194 /* Build configuration list for PBXNativeTarget "Clima" */; + buildPhases = ( + ADAA27A9231BBFAF00365194 /* Sources */, + ADAA27AA231BBFAF00365194 /* Frameworks */, + ADAA27AB231BBFAF00365194 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Clima; + productName = Clima; + productReference = ADAA27AD231BBFAF00365194 /* Clima.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + ADAA27A5231BBFAF00365194 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1100; + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = "App Brewery"; + TargetAttributes = { + ADAA27AC231BBFAF00365194 = { + CreatedOnToolsVersion = 11.0; + }; + }; + }; + buildConfigurationList = ADAA27A8231BBFAF00365194 /* Build configuration list for PBXProject "Clima" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = ADAA27A4231BBFAF00365194; + productRefGroup = ADAA27AE231BBFAF00365194 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + ADAA27AC231BBFAF00365194 /* Clima */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + ADAA27AB231BBFAF00365194 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ADAA27CE231BC87F00365194 /* README.md in Resources */, + ADAA27BD231BBFB300365194 /* LaunchScreen.storyboard in Resources */, + ADAA27BA231BBFB300365194 /* Assets.xcassets in Resources */, + ADAA27B8231BBFAF00365194 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + ADAA27A9231BBFAF00365194 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ADAA27B5231BBFAF00365194 /* WeatherViewController.swift in Sources */, + 94B460CE24941CB8006A2DBC /* WeatherData.swift in Sources */, + ADAA27B1231BBFAF00365194 /* AppDelegate.swift in Sources */, + 9438B8D32492DE2100B48867 /* WeatherManager.swift in Sources */, + 94B460D024943438006A2DBC /* WeatherModel.swift in Sources */, + ADAA27B3231BBFAF00365194 /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + ADAA27B6231BBFAF00365194 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + ADAA27B7231BBFAF00365194 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + ADAA27BB231BBFB300365194 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + ADAA27BC231BBFB300365194 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + ADAA27BF231BBFB300365194 /* 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; + }; + ADAA27C0231BBFB300365194 /* 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; + }; + ADAA27C2231BBFB300365194 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Clima/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.appbrewery.Clima; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + ADAA27C3231BBFB300365194 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Clima/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.appbrewery.Clima; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + ADAA27A8231BBFAF00365194 /* Build configuration list for PBXProject "Clima" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ADAA27BF231BBFB300365194 /* Debug */, + ADAA27C0231BBFB300365194 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ADAA27C1231BBFB300365194 /* Build configuration list for PBXNativeTarget "Clima" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ADAA27C2231BBFB300365194 /* Debug */, + ADAA27C3231BBFB300365194 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = ADAA27A5231BBFAF00365194 /* Project object */; +} diff --git a/Clima.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Clima.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..34bc8b3 --- /dev/null +++ b/Clima.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Clima.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Clima.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Clima.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Clima.xcodeproj/project.xcworkspace/xcuserdata/jamesbissick.xcuserdatad/UserInterfaceState.xcuserstate b/Clima.xcodeproj/project.xcworkspace/xcuserdata/jamesbissick.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..7efca51 Binary files /dev/null and b/Clima.xcodeproj/project.xcworkspace/xcuserdata/jamesbissick.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Clima.xcodeproj/xcuserdata/angelayu.xcuserdatad/xcschemes/xcschememanagement.plist b/Clima.xcodeproj/xcuserdata/angelayu.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..ab52110 --- /dev/null +++ b/Clima.xcodeproj/xcuserdata/angelayu.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Clima.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Clima.xcodeproj/xcuserdata/jamesbissick.xcuserdatad/xcschemes/xcschememanagement.plist b/Clima.xcodeproj/xcuserdata/jamesbissick.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..ab52110 --- /dev/null +++ b/Clima.xcodeproj/xcuserdata/jamesbissick.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Clima.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Clima/AppDelegate.swift b/Clima/AppDelegate.swift new file mode 100644 index 0000000..b618e6a --- /dev/null +++ b/Clima/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// Clima +// +// Created by Angela Yu on 01/09/2019. +// Copyright © 2019 App Brewery. 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/Clima/Assets.xcassets/AppIcon.appiconset/100.png b/Clima/Assets.xcassets/AppIcon.appiconset/100.png new file mode 100755 index 0000000..c86037c Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/100.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/1024.png b/Clima/Assets.xcassets/AppIcon.appiconset/1024.png new file mode 100755 index 0000000..8ee7326 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/1024.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/114.png b/Clima/Assets.xcassets/AppIcon.appiconset/114.png new file mode 100755 index 0000000..a05d66f Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/114.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/120.png b/Clima/Assets.xcassets/AppIcon.appiconset/120.png new file mode 100755 index 0000000..3f373ff Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/120.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/144.png b/Clima/Assets.xcassets/AppIcon.appiconset/144.png new file mode 100755 index 0000000..9701d46 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/144.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/152.png b/Clima/Assets.xcassets/AppIcon.appiconset/152.png new file mode 100755 index 0000000..9a96b6a Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/152.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/167.png b/Clima/Assets.xcassets/AppIcon.appiconset/167.png new file mode 100755 index 0000000..e46baf0 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/167.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/180.png b/Clima/Assets.xcassets/AppIcon.appiconset/180.png new file mode 100755 index 0000000..420dec3 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/180.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/20.png b/Clima/Assets.xcassets/AppIcon.appiconset/20.png new file mode 100755 index 0000000..2b3904a Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/20.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/29.png b/Clima/Assets.xcassets/AppIcon.appiconset/29.png new file mode 100755 index 0000000..2436c96 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/29.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/40.png b/Clima/Assets.xcassets/AppIcon.appiconset/40.png new file mode 100755 index 0000000..093b4c3 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/40.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/50.png b/Clima/Assets.xcassets/AppIcon.appiconset/50.png new file mode 100755 index 0000000..941e007 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/50.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/57.png b/Clima/Assets.xcassets/AppIcon.appiconset/57.png new file mode 100755 index 0000000..444b15d Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/57.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/58.png b/Clima/Assets.xcassets/AppIcon.appiconset/58.png new file mode 100755 index 0000000..b2298a1 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/58.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/60.png b/Clima/Assets.xcassets/AppIcon.appiconset/60.png new file mode 100755 index 0000000..40b0145 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/60.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/72.png b/Clima/Assets.xcassets/AppIcon.appiconset/72.png new file mode 100755 index 0000000..a79fa65 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/72.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/76.png b/Clima/Assets.xcassets/AppIcon.appiconset/76.png new file mode 100755 index 0000000..af7fc04 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/76.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/80.png b/Clima/Assets.xcassets/AppIcon.appiconset/80.png new file mode 100755 index 0000000..371bef5 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/80.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/87.png b/Clima/Assets.xcassets/AppIcon.appiconset/87.png new file mode 100755 index 0000000..a959875 Binary files /dev/null and b/Clima/Assets.xcassets/AppIcon.appiconset/87.png differ diff --git a/Clima/Assets.xcassets/AppIcon.appiconset/Contents.json b/Clima/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100755 index 0000000..14225f5 --- /dev/null +++ b/Clima/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,158 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "40.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "60.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "58.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "87.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "80.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "120.png", + "scale" : "3x" + }, + { + "size" : "57x57", + "idiom" : "iphone", + "filename" : "57.png", + "scale" : "1x" + }, + { + "size" : "57x57", + "idiom" : "iphone", + "filename" : "114.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "120.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "180.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "20.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "40.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "58.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "80.png", + "scale" : "2x" + }, + { + "size" : "50x50", + "idiom" : "ipad", + "filename" : "50.png", + "scale" : "1x" + }, + { + "size" : "50x50", + "idiom" : "ipad", + "filename" : "100.png", + "scale" : "2x" + }, + { + "size" : "72x72", + "idiom" : "ipad", + "filename" : "72.png", + "scale" : "1x" + }, + { + "size" : "72x72", + "idiom" : "ipad", + "filename" : "144.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "152.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "167.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "1024.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Clima/Assets.xcassets/Contents.json b/Clima/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Clima/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Clima/Assets.xcassets/background.imageset/Contents.json b/Clima/Assets.xcassets/background.imageset/Contents.json new file mode 100644 index 0000000..7750ffd --- /dev/null +++ b/Clima/Assets.xcassets/background.imageset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "filename" : "light_background-1.pdf", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "light" + } + ], + "filename" : "light_background-2.pdf", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "dark_background.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true + } +} diff --git a/Clima/Assets.xcassets/background.imageset/dark_background.pdf b/Clima/Assets.xcassets/background.imageset/dark_background.pdf new file mode 100644 index 0000000..55fa666 Binary files /dev/null and b/Clima/Assets.xcassets/background.imageset/dark_background.pdf differ diff --git a/Clima/Assets.xcassets/background.imageset/light_background-1.pdf b/Clima/Assets.xcassets/background.imageset/light_background-1.pdf new file mode 100644 index 0000000..1f3a3e7 Binary files /dev/null and b/Clima/Assets.xcassets/background.imageset/light_background-1.pdf differ diff --git a/Clima/Assets.xcassets/background.imageset/light_background-2.pdf b/Clima/Assets.xcassets/background.imageset/light_background-2.pdf new file mode 100644 index 0000000..1f3a3e7 Binary files /dev/null and b/Clima/Assets.xcassets/background.imageset/light_background-2.pdf differ diff --git a/Clima/Assets.xcassets/weatherColor.colorset/Contents.json b/Clima/Assets.xcassets/weatherColor.colorset/Contents.json new file mode 100644 index 0000000..c6edb38 --- /dev/null +++ b/Clima/Assets.xcassets/weatherColor.colorset/Contents.json @@ -0,0 +1,56 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "display-p3", + "components" : { + "alpha" : "1.000", + "blue" : "0.282", + "green" : "0.262", + "red" : "0.108" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "light" + } + ], + "color" : { + "color-space" : "display-p3", + "components" : { + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000", + "red" : "0.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Clima/Base.lproj/LaunchScreen.storyboard b/Clima/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/Clima/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clima/Controller/WeatherViewController.swift b/Clima/Controller/WeatherViewController.swift new file mode 100644 index 0000000..c0ac4d8 --- /dev/null +++ b/Clima/Controller/WeatherViewController.swift @@ -0,0 +1,105 @@ +// +// ViewController.swift +// Clima +// +// Created by Angela Yu on 01/09/2019. +// Copyright © 2019 App Brewery. All rights reserved. +// + +import UIKit +import CoreLocation + +class WeatherViewController: UIViewController { + + @IBOutlet weak var conditionImageView: UIImageView! + @IBOutlet weak var temperatureLabel: UILabel! + @IBOutlet weak var cityLabel: UILabel! + @IBOutlet weak var searchTextField: UITextField! + + var weatherManager = WeatherManager() + let locationManager = CLLocationManager() + + override func viewDidLoad() { + super.viewDidLoad() + + locationManager.delegate = self + locationManager.requestWhenInUseAuthorization() + locationManager.requestLocation() + + weatherManager.delegate = self + searchTextField.delegate = self + } + @IBAction func locationPressed(_ sender: UIButton) { + locationManager.requestLocation() + } + +} + +//MARK: - UITextFieldDelegate + + +extension WeatherViewController: UITextFieldDelegate { + + @IBAction func searchPressed(_ sender: UIButton) { + searchTextField.endEditing(true) + } + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + searchTextField.endEditing(true) + return true + } + + func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { + if textField.text != "" { + return true + } else { + textField.placeholder = "Type something" + return false + } + } + + func textFieldDidEndEditing(_ textField: UITextField) { + + if let city = searchTextField.text { + weatherManager.fetchWeather(cityName: city) + } + + searchTextField.text = "" + } +} + +//MARK: - WeatherManagerDelegate + + +extension WeatherViewController: WeatherManagerDelegate { + + func didUpdateWeather(_ weatherManager: WeatherManager, weather: WeatherModel) { + DispatchQueue.main.async { + self.temperatureLabel.text = weather.temperatureString + self.conditionImageView.image = UIImage(systemName: weather.conditionName) + self.cityLabel.text = weather.cityName + } + } + + func didFailWithError(error: Error) { + print(error) + } +} + + +//MARK: - CLLocationManagerDelegate + +extension WeatherViewController: CLLocationManagerDelegate { + func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { + if let location = locations.last { + locationManager.stopUpdatingLocation() + let lat = location.coordinate.latitude + let lon = location.coordinate.longitude + weatherManager.fetchWeather(latitude: lat, longitude: lon) + } + } + + func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { + print(error) + } +} diff --git a/Clima/Info.plist b/Clima/Info.plist new file mode 100644 index 0000000..f8d5ed5 --- /dev/null +++ b/Clima/Info.plist @@ -0,0 +1,64 @@ + + + + + NSLocationWhenInUseUsageDescription + We need your location to get the current weather for where you are. + 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 + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Clima/SceneDelegate.swift b/Clima/SceneDelegate.swift new file mode 100644 index 0000000..a9145a3 --- /dev/null +++ b/Clima/SceneDelegate.swift @@ -0,0 +1,53 @@ +// +// SceneDelegate.swift +// Clima +// +// Created by Angela Yu on 01/09/2019. +// Copyright © 2019 App Brewery. 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/Clima/View/Base.lproj/Main.storyboard b/Clima/View/Base.lproj/Main.storyboard new file mode 100644 index 0000000..802e582 --- /dev/null +++ b/Clima/View/Base.lproj/Main.storyboard @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clima/WeatherData.swift b/Clima/WeatherData.swift new file mode 100644 index 0000000..bdf2b89 --- /dev/null +++ b/Clima/WeatherData.swift @@ -0,0 +1,25 @@ +// +// WeatherData.swift +// Clima +// +// Created by James Bissick on 12/06/2020. +// Copyright © 2020 App Brewery. All rights reserved. +// + +import Foundation + +struct WeatherData: Codable { + let name: String + let main: Main + let weather: [Weather] + +} + +struct Main: Codable { + let temp: Double +} + +struct Weather: Codable { + let id: Int + let description: String +} diff --git a/Clima/WeatherManager.swift b/Clima/WeatherManager.swift new file mode 100644 index 0000000..d445aad --- /dev/null +++ b/Clima/WeatherManager.swift @@ -0,0 +1,71 @@ +// +// WeatherManager.swift +// Clima +// +// Created by James Bissick on 11/06/2020. +// Copyright © 2020 App Brewery. All rights reserved. +// + +import Foundation +import CoreLocation + +protocol WeatherManagerDelegate { + func didUpdateWeather(_ weatherManager: WeatherManager, weather: WeatherModel) + func didFailWithError(error: Error) +} + +struct WeatherManager { + let weatherURL = "https://api.openweathermap.org/data/2.5/weather?appid=99e3ba553f58bb276e1076c3b8d49072&units=metric" + + var delegate: WeatherManagerDelegate? + + func fetchWeather(cityName: String) { + let urlString = "\(weatherURL)&q=\(cityName)" + performRequest(with: urlString) + } + + func fetchWeather(latitude: CLLocationDegrees, longitude: CLLocationDegrees) { + let urlString = "\(weatherURL)&lat=\(latitude)&lon=\(longitude)" + performRequest(with: urlString) + } + + func performRequest(with urlString: String) { + + if let url = URL(string: urlString) { + + let session = URLSession(configuration: .default) + let task = session.dataTask(with: url) { (data, response, error) in + if error != nil { + self.delegate?.didFailWithError(error: error!) + return + } + + if let safeData = data { + if let weather = self.parseJSON(safeData) { + self.delegate?.didUpdateWeather(self, weather: weather) + } + } + } + task.resume() + } + } + + func parseJSON(_ weatherData: Data) -> WeatherModel? { + let decoder = JSONDecoder() + do { + let decodedData = try decoder.decode(WeatherData.self, from: weatherData) + let id = decodedData.weather[0].id + let temp = decodedData.main.temp + let name = decodedData.name + + let weather = WeatherModel(conditionId: id, cityName: name, temperature: temp) + + return weather + + } catch { + delegate?.didFailWithError(error: error) + return nil + } + } + +} diff --git a/Clima/WeatherModel.swift b/Clima/WeatherModel.swift new file mode 100644 index 0000000..522308f --- /dev/null +++ b/Clima/WeatherModel.swift @@ -0,0 +1,42 @@ +// +// WeatherModel.swift +// Clima +// +// Created by James Bissick on 13/06/2020. +// Copyright © 2020 App Brewery. All rights reserved. +// + +import Foundation + +struct WeatherModel { + let conditionId: Int + let cityName: String + let temperature: Double + + var temperatureString: String { + return String(format: "%.1f", temperature) + } + + var conditionName: String { + + switch conditionId { + case 200...232: + return "cloud.bolt" + case 200...232: + return "cloud.drizzle" + case 200...232: + return "cloud.rain" + case 200...232: + return "cloud.snow" + case 200...232: + return "cloud.fog" + case 200...232: + return "sun.max" + case 200...232: + return "cloud.bolt" + default: + return "cloud" + } + } + +} diff --git a/Documentation/AppBreweryBanner.png b/Documentation/AppBreweryBanner.png new file mode 100644 index 0000000..767d0e9 Binary files /dev/null and b/Documentation/AppBreweryBanner.png differ diff --git a/Documentation/readme-end-banner.png b/Documentation/readme-end-banner.png new file mode 100644 index 0000000..e12d9ca Binary files /dev/null and b/Documentation/readme-end-banner.png differ