├── README.md ├── Weather.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── bobby.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Weather ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── clear-day.imageset │ │ ├── Contents.json │ │ └── clear-day.png │ ├── clear-night.imageset │ │ ├── Contents.json │ │ └── clear-night.png │ ├── cloudy.imageset │ │ ├── Contents.json │ │ └── cloudy.png │ ├── dark-sky-logo.imageset │ │ ├── Contents.json │ │ └── DarkSkyLogo.png │ ├── default.imageset │ │ ├── Contents.json │ │ └── default.png │ ├── fog.imageset │ │ ├── Contents.json │ │ └── fog.png │ ├── partly-cloudy-day.imageset │ │ ├── Contents.json │ │ └── partly-cloudy-day.png │ ├── partly-cloudy-night.imageset │ │ ├── Contents.json │ │ └── partly-cloudy-night.png │ ├── rain.imageset │ │ ├── Contents.json │ │ └── rain.png │ ├── sleet.imageset │ │ ├── Contents.json │ │ └── sleet.png │ ├── snow.imageset │ │ ├── Contents.json │ │ └── snow.png │ └── wind.imageset │ │ ├── Contents.json │ │ └── wind.png ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist ├── Model │ ├── Coordinate.swift │ ├── CurrentWeather.swift │ ├── DailyWeather.swift │ └── Weather.swift ├── Networking │ ├── DarkSkyAPIClient.swift │ ├── DarkSkyError.swift │ └── NetworkManager.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── SceneDelegate.swift ├── View Model │ ├── CurrentWeatherViewModel.swift │ └── DailyWeatherViewModel.swift └── View │ ├── BackgroundView.swift │ ├── ContentView.swift │ ├── CurrentWeatherView.swift │ ├── DailyWeatherView.swift │ ├── FooterView.swift │ └── HeaderView.swift └── screenshot1.png /README.md: -------------------------------------------------------------------------------- 1 | # Weather-SwiftUI 2 | 3 |
4 | 5 | 6 | ## Overview 7 | 8 | Weather-SwiftUI is a weather app that uses the Dark Sky API built using SwiftUI! Get the current weather for a particular location and check out the 5-day forecast! The app incorporates: 9 | 10 | - SwiftUI 11 | - Stacks 12 | - Images and Text 13 | - Gradients 14 | - Parsing JSON using Codable 15 | - Error Handling 16 | - MVVM 17 | 18 | ## Custom Features 19 | 20 | Additional features were added to the original functionality of the app, including: 21 | 22 | - Custom, dynamic UI using SwiftUI 23 | - Expanded CurrentWeather model including apparent temperature and wind speed 24 | - Included 5-day forecast 25 | 26 | ## Getting Started 27 | 28 | > This app is not available on the App Store. 29 | 30 | ### Prerequisites 31 | 32 | - A valid API key from Dark Sky 33 | - A Mac running macOS Catalina (beta) 34 | - Xcode 11 (beta) 35 | 36 | ### Installation 37 | 38 | 1. Clone or download the project to your local machine 39 | 2. Open the project in Xcode 40 | 3. Replace `YOURAPIKEY` with your valid Dark Sky API key in `DarkSkyAPIClient.swift` 41 | 42 | ```swift 43 | class DarkSkyAPIClient { 44 | fileprivate let darkSkyApiKey = "YOURAPIKEY" 45 | ``` 46 | 47 | 4. Run the simulator 48 | 49 | ## Acknowledgements 50 | 51 | The following resources were used in the development of this project. All custom code is my own. 52 | 53 | - [Build a Weather App](https://teamtreehouse.com/library/build-a-weather-app-5) 54 | - [SwiftUI Fetching JSON and Image Data with BindableObject](https://www.youtube.com/watch?v=xT4wGOc2jd4) 55 | - Graphics: [Meteocons](https://www.iconfinder.com/iconsets/meteocons) by [Alessio Atzeni](https://www.iconfinder.com/Bluxart) 56 | 57 | Interested in learning more about iOS Development? [Sign up today](http://referrals.trhou.se/bobbyconti1)! 58 | -------------------------------------------------------------------------------- /Weather.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C50872F722B579EA005FF617 /* BackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C50872F622B579EA005FF617 /* BackgroundView.swift */; }; 11 | C531355122AF325E005886DA /* DailyWeather.swift in Sources */ = {isa = PBXBuildFile; fileRef = C531355022AF325E005886DA /* DailyWeather.swift */; }; 12 | C531355322AF34CD005886DA /* DailyWeatherViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C531355222AF34CD005886DA /* DailyWeatherViewModel.swift */; }; 13 | C531355522AF4AD1005886DA /* CurrentWeatherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C531355422AF4AD1005886DA /* CurrentWeatherView.swift */; }; 14 | C531355722AF4AE1005886DA /* DailyWeatherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C531355622AF4AE1005886DA /* DailyWeatherView.swift */; }; 15 | C5768B6822AF29C0001DC01D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B6722AF29C0001DC01D /* AppDelegate.swift */; }; 16 | C5768B6A22AF29C0001DC01D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B6922AF29C0001DC01D /* SceneDelegate.swift */; }; 17 | C5768B6C22AF29C0001DC01D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B6B22AF29C0001DC01D /* ContentView.swift */; }; 18 | C5768B6E22AF29C0001DC01D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5768B6D22AF29C0001DC01D /* Assets.xcassets */; }; 19 | C5768B7122AF29C0001DC01D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5768B7022AF29C0001DC01D /* Preview Assets.xcassets */; }; 20 | C5768B7422AF29C0001DC01D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C5768B7222AF29C0001DC01D /* LaunchScreen.storyboard */; }; 21 | C5768B8122AF2A1D001DC01D /* DarkSkyAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B7B22AF2A1D001DC01D /* DarkSkyAPIClient.swift */; }; 22 | C5768B8222AF2A1D001DC01D /* Coordinate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B7C22AF2A1D001DC01D /* Coordinate.swift */; }; 23 | C5768B8322AF2A1D001DC01D /* CurrentWeatherViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B7D22AF2A1D001DC01D /* CurrentWeatherViewModel.swift */; }; 24 | C5768B8422AF2A1D001DC01D /* CurrentWeather.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B7E22AF2A1D001DC01D /* CurrentWeather.swift */; }; 25 | C5768B8522AF2A1D001DC01D /* DarkSkyError.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B7F22AF2A1D001DC01D /* DarkSkyError.swift */; }; 26 | C5768B8622AF2A1D001DC01D /* Weather.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5768B8022AF2A1D001DC01D /* Weather.swift */; }; 27 | C5ACDEE422B1B1EB007E6A0F /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5ACDEE322B1B1EB007E6A0F /* NetworkManager.swift */; }; 28 | C5E8A9CF22B7FE5F00BD44C8 /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E8A9CE22B7FE5F00BD44C8 /* HeaderView.swift */; }; 29 | C5E8A9D122B808DB00BD44C8 /* FooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E8A9D022B808DB00BD44C8 /* FooterView.swift */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | C50872F622B579EA005FF617 /* BackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundView.swift; sourceTree = ""; }; 34 | C531355022AF325E005886DA /* DailyWeather.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyWeather.swift; sourceTree = ""; }; 35 | C531355222AF34CD005886DA /* DailyWeatherViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyWeatherViewModel.swift; sourceTree = ""; }; 36 | C531355422AF4AD1005886DA /* CurrentWeatherView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentWeatherView.swift; sourceTree = ""; }; 37 | C531355622AF4AE1005886DA /* DailyWeatherView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyWeatherView.swift; sourceTree = ""; }; 38 | C5768B6422AF29C0001DC01D /* Weather.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Weather.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | C5768B6722AF29C0001DC01D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | C5768B6922AF29C0001DC01D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 41 | C5768B6B22AF29C0001DC01D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 42 | C5768B6D22AF29C0001DC01D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | C5768B7022AF29C0001DC01D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 44 | C5768B7322AF29C0001DC01D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | C5768B7522AF29C0001DC01D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | C5768B7B22AF2A1D001DC01D /* DarkSkyAPIClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DarkSkyAPIClient.swift; sourceTree = ""; }; 47 | C5768B7C22AF2A1D001DC01D /* Coordinate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Coordinate.swift; sourceTree = ""; }; 48 | C5768B7D22AF2A1D001DC01D /* CurrentWeatherViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentWeatherViewModel.swift; sourceTree = ""; }; 49 | C5768B7E22AF2A1D001DC01D /* CurrentWeather.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurrentWeather.swift; sourceTree = ""; }; 50 | C5768B7F22AF2A1D001DC01D /* DarkSkyError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DarkSkyError.swift; sourceTree = ""; }; 51 | C5768B8022AF2A1D001DC01D /* Weather.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Weather.swift; sourceTree = ""; }; 52 | C5ACDEE322B1B1EB007E6A0F /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; 53 | C5E8A9CE22B7FE5F00BD44C8 /* HeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderView.swift; sourceTree = ""; }; 54 | C5E8A9D022B808DB00BD44C8 /* FooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterView.swift; sourceTree = ""; }; 55 | /* End PBXFileReference section */ 56 | 57 | /* Begin PBXFrameworksBuildPhase section */ 58 | C5768B6122AF29C0001DC01D /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | C53A3F5E22AF2CA400D61DA3 /* Model */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | C5768B8022AF2A1D001DC01D /* Weather.swift */, 72 | C5768B7E22AF2A1D001DC01D /* CurrentWeather.swift */, 73 | C531355022AF325E005886DA /* DailyWeather.swift */, 74 | C5768B7C22AF2A1D001DC01D /* Coordinate.swift */, 75 | ); 76 | path = Model; 77 | sourceTree = ""; 78 | }; 79 | C53A3F5F22AF2CB200D61DA3 /* View */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | C5768B6B22AF29C0001DC01D /* ContentView.swift */, 83 | C50872F622B579EA005FF617 /* BackgroundView.swift */, 84 | C5E8A9CE22B7FE5F00BD44C8 /* HeaderView.swift */, 85 | C531355422AF4AD1005886DA /* CurrentWeatherView.swift */, 86 | C531355622AF4AE1005886DA /* DailyWeatherView.swift */, 87 | C5E8A9D022B808DB00BD44C8 /* FooterView.swift */, 88 | ); 89 | path = View; 90 | sourceTree = ""; 91 | }; 92 | C53A3F6022AF2CBD00D61DA3 /* View Model */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | C5768B7D22AF2A1D001DC01D /* CurrentWeatherViewModel.swift */, 96 | C531355222AF34CD005886DA /* DailyWeatherViewModel.swift */, 97 | ); 98 | path = "View Model"; 99 | sourceTree = ""; 100 | }; 101 | C53A3F6122AF2CC700D61DA3 /* Networking */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | C5ACDEE322B1B1EB007E6A0F /* NetworkManager.swift */, 105 | C5768B7B22AF2A1D001DC01D /* DarkSkyAPIClient.swift */, 106 | C5768B7F22AF2A1D001DC01D /* DarkSkyError.swift */, 107 | ); 108 | path = Networking; 109 | sourceTree = ""; 110 | }; 111 | C5768B5B22AF29C0001DC01D = { 112 | isa = PBXGroup; 113 | children = ( 114 | C5768B6622AF29C0001DC01D /* Weather */, 115 | C5768B6522AF29C0001DC01D /* Products */, 116 | ); 117 | sourceTree = ""; 118 | }; 119 | C5768B6522AF29C0001DC01D /* Products */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | C5768B6422AF29C0001DC01D /* Weather.app */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | C5768B6622AF29C0001DC01D /* Weather */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | C5768B6722AF29C0001DC01D /* AppDelegate.swift */, 131 | C5768B6922AF29C0001DC01D /* SceneDelegate.swift */, 132 | C53A3F5F22AF2CB200D61DA3 /* View */, 133 | C53A3F6122AF2CC700D61DA3 /* Networking */, 134 | C53A3F6022AF2CBD00D61DA3 /* View Model */, 135 | C53A3F5E22AF2CA400D61DA3 /* Model */, 136 | C5768B6D22AF29C0001DC01D /* Assets.xcassets */, 137 | C5768B7222AF29C0001DC01D /* LaunchScreen.storyboard */, 138 | C5768B7522AF29C0001DC01D /* Info.plist */, 139 | C5768B6F22AF29C0001DC01D /* Preview Content */, 140 | ); 141 | path = Weather; 142 | sourceTree = ""; 143 | }; 144 | C5768B6F22AF29C0001DC01D /* Preview Content */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | C5768B7022AF29C0001DC01D /* Preview Assets.xcassets */, 148 | ); 149 | path = "Preview Content"; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | C5768B6322AF29C0001DC01D /* Weather */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = C5768B7822AF29C0001DC01D /* Build configuration list for PBXNativeTarget "Weather" */; 158 | buildPhases = ( 159 | C5768B6022AF29C0001DC01D /* Sources */, 160 | C5768B6122AF29C0001DC01D /* Frameworks */, 161 | C5768B6222AF29C0001DC01D /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = Weather; 168 | productName = Weather; 169 | productReference = C5768B6422AF29C0001DC01D /* Weather.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | C5768B5C22AF29C0001DC01D /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | LastSwiftUpdateCheck = 1100; 179 | LastUpgradeCheck = 1100; 180 | ORGANIZATIONNAME = "Bobby Conti"; 181 | TargetAttributes = { 182 | C5768B6322AF29C0001DC01D = { 183 | CreatedOnToolsVersion = 11.0; 184 | }; 185 | }; 186 | }; 187 | buildConfigurationList = C5768B5F22AF29C0001DC01D /* Build configuration list for PBXProject "Weather" */; 188 | compatibilityVersion = "Xcode 9.3"; 189 | developmentRegion = en; 190 | hasScannedForEncodings = 0; 191 | knownRegions = ( 192 | en, 193 | Base, 194 | ); 195 | mainGroup = C5768B5B22AF29C0001DC01D; 196 | productRefGroup = C5768B6522AF29C0001DC01D /* Products */; 197 | projectDirPath = ""; 198 | projectRoot = ""; 199 | targets = ( 200 | C5768B6322AF29C0001DC01D /* Weather */, 201 | ); 202 | }; 203 | /* End PBXProject section */ 204 | 205 | /* Begin PBXResourcesBuildPhase section */ 206 | C5768B6222AF29C0001DC01D /* Resources */ = { 207 | isa = PBXResourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | C5768B7422AF29C0001DC01D /* LaunchScreen.storyboard in Resources */, 211 | C5768B7122AF29C0001DC01D /* Preview Assets.xcassets in Resources */, 212 | C5768B6E22AF29C0001DC01D /* Assets.xcassets in Resources */, 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXResourcesBuildPhase section */ 217 | 218 | /* Begin PBXSourcesBuildPhase section */ 219 | C5768B6022AF29C0001DC01D /* Sources */ = { 220 | isa = PBXSourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | C50872F722B579EA005FF617 /* BackgroundView.swift in Sources */, 224 | C531355122AF325E005886DA /* DailyWeather.swift in Sources */, 225 | C5768B8522AF2A1D001DC01D /* DarkSkyError.swift in Sources */, 226 | C5768B6822AF29C0001DC01D /* AppDelegate.swift in Sources */, 227 | C5768B6A22AF29C0001DC01D /* SceneDelegate.swift in Sources */, 228 | C531355722AF4AE1005886DA /* DailyWeatherView.swift in Sources */, 229 | C5768B6C22AF29C0001DC01D /* ContentView.swift in Sources */, 230 | C5768B8622AF2A1D001DC01D /* Weather.swift in Sources */, 231 | C5768B8422AF2A1D001DC01D /* CurrentWeather.swift in Sources */, 232 | C5768B8122AF2A1D001DC01D /* DarkSkyAPIClient.swift in Sources */, 233 | C5768B8222AF2A1D001DC01D /* Coordinate.swift in Sources */, 234 | C5ACDEE422B1B1EB007E6A0F /* NetworkManager.swift in Sources */, 235 | C531355522AF4AD1005886DA /* CurrentWeatherView.swift in Sources */, 236 | C531355322AF34CD005886DA /* DailyWeatherViewModel.swift in Sources */, 237 | C5768B8322AF2A1D001DC01D /* CurrentWeatherViewModel.swift in Sources */, 238 | C5E8A9CF22B7FE5F00BD44C8 /* HeaderView.swift in Sources */, 239 | C5E8A9D122B808DB00BD44C8 /* FooterView.swift in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin PBXVariantGroup section */ 246 | C5768B7222AF29C0001DC01D /* LaunchScreen.storyboard */ = { 247 | isa = PBXVariantGroup; 248 | children = ( 249 | C5768B7322AF29C0001DC01D /* Base */, 250 | ); 251 | name = LaunchScreen.storyboard; 252 | sourceTree = ""; 253 | }; 254 | /* End PBXVariantGroup section */ 255 | 256 | /* Begin XCBuildConfiguration section */ 257 | C5768B7622AF29C0001DC01D /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 263 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 264 | CLANG_CXX_LIBRARY = "libc++"; 265 | CLANG_ENABLE_MODULES = YES; 266 | CLANG_ENABLE_OBJC_ARC = YES; 267 | CLANG_ENABLE_OBJC_WEAK = YES; 268 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 269 | CLANG_WARN_BOOL_CONVERSION = YES; 270 | CLANG_WARN_COMMA = YES; 271 | CLANG_WARN_CONSTANT_CONVERSION = YES; 272 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 273 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 274 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 281 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 282 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 283 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 284 | CLANG_WARN_STRICT_PROTOTYPES = YES; 285 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 286 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | COPY_PHASE_STRIP = NO; 290 | DEBUG_INFORMATION_FORMAT = dwarf; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | ENABLE_TESTABILITY = YES; 293 | GCC_C_LANGUAGE_STANDARD = gnu11; 294 | GCC_DYNAMIC_NO_PIC = NO; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_OPTIMIZATION_LEVEL = 0; 297 | GCC_PREPROCESSOR_DEFINITIONS = ( 298 | "DEBUG=1", 299 | "$(inherited)", 300 | ); 301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 303 | GCC_WARN_UNDECLARED_SELECTOR = YES; 304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 305 | GCC_WARN_UNUSED_FUNCTION = YES; 306 | GCC_WARN_UNUSED_VARIABLE = YES; 307 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 308 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 309 | MTL_FAST_MATH = YES; 310 | ONLY_ACTIVE_ARCH = YES; 311 | SDKROOT = iphoneos; 312 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 313 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 314 | }; 315 | name = Debug; 316 | }; 317 | C5768B7722AF29C0001DC01D /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_ANALYZER_NONNULL = YES; 322 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 323 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 324 | CLANG_CXX_LIBRARY = "libc++"; 325 | CLANG_ENABLE_MODULES = YES; 326 | CLANG_ENABLE_OBJC_ARC = YES; 327 | CLANG_ENABLE_OBJC_WEAK = YES; 328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_COMMA = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 344 | CLANG_WARN_STRICT_PROTOTYPES = YES; 345 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 346 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 347 | CLANG_WARN_UNREACHABLE_CODE = YES; 348 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 351 | ENABLE_NS_ASSERTIONS = NO; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu11; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 362 | MTL_ENABLE_DEBUG_INFO = NO; 363 | MTL_FAST_MATH = YES; 364 | SDKROOT = iphoneos; 365 | SWIFT_COMPILATION_MODE = wholemodule; 366 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 367 | VALIDATE_PRODUCT = YES; 368 | }; 369 | name = Release; 370 | }; 371 | C5768B7922AF29C0001DC01D /* Debug */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 375 | CODE_SIGN_STYLE = Automatic; 376 | DEVELOPMENT_ASSET_PATHS = "Weather/Preview\\ Content"; 377 | DEVELOPMENT_TEAM = TRB6J62PGA; 378 | ENABLE_PREVIEWS = YES; 379 | INFOPLIST_FILE = Weather/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = ( 381 | "$(inherited)", 382 | "@executable_path/Frameworks", 383 | ); 384 | PRODUCT_BUNDLE_IDENTIFIER = com.bobbyconti.Weather; 385 | PRODUCT_NAME = "$(TARGET_NAME)"; 386 | SWIFT_VERSION = 5.0; 387 | TARGETED_DEVICE_FAMILY = "1,2"; 388 | }; 389 | name = Debug; 390 | }; 391 | C5768B7A22AF29C0001DC01D /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 395 | CODE_SIGN_STYLE = Automatic; 396 | DEVELOPMENT_ASSET_PATHS = "Weather/Preview\\ Content"; 397 | DEVELOPMENT_TEAM = TRB6J62PGA; 398 | ENABLE_PREVIEWS = YES; 399 | INFOPLIST_FILE = Weather/Info.plist; 400 | LD_RUNPATH_SEARCH_PATHS = ( 401 | "$(inherited)", 402 | "@executable_path/Frameworks", 403 | ); 404 | PRODUCT_BUNDLE_IDENTIFIER = com.bobbyconti.Weather; 405 | PRODUCT_NAME = "$(TARGET_NAME)"; 406 | SWIFT_VERSION = 5.0; 407 | TARGETED_DEVICE_FAMILY = "1,2"; 408 | }; 409 | name = Release; 410 | }; 411 | /* End XCBuildConfiguration section */ 412 | 413 | /* Begin XCConfigurationList section */ 414 | C5768B5F22AF29C0001DC01D /* Build configuration list for PBXProject "Weather" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | C5768B7622AF29C0001DC01D /* Debug */, 418 | C5768B7722AF29C0001DC01D /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | C5768B7822AF29C0001DC01D /* Build configuration list for PBXNativeTarget "Weather" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | C5768B7922AF29C0001DC01D /* Debug */, 427 | C5768B7A22AF29C0001DC01D /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | /* End XCConfigurationList section */ 433 | }; 434 | rootObject = C5768B5C22AF29C0001DC01D /* Project object */; 435 | } 436 | -------------------------------------------------------------------------------- /Weather.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Weather.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Weather.xcodeproj/xcuserdata/bobby.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Weather.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Weather/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillTerminate(_ application: UIApplication) { 22 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 23 | } 24 | 25 | // MARK: UISceneSession Lifecycle 26 | 27 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 28 | // Called when a new scene session is being created. 29 | // Use this method to select a configuration to create the new scene with. 30 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 31 | } 32 | 33 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 34 | // Called when the user discards a scene session. 35 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 36 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 37 | } 38 | 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Weather/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/clear-day.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "clear-day.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/clear-day.imageset/clear-day.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/clear-day.imageset/clear-day.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/clear-night.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "clear-night.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/clear-night.imageset/clear-night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/clear-night.imageset/clear-night.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/cloudy.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "cloudy.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/cloudy.imageset/cloudy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/cloudy.imageset/cloudy.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/dark-sky-logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "DarkSkyLogo.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/dark-sky-logo.imageset/DarkSkyLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/dark-sky-logo.imageset/DarkSkyLogo.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/default.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "default.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/default.imageset/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/default.imageset/default.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/fog.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "fog.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/fog.imageset/fog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/fog.imageset/fog.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/partly-cloudy-day.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "partly-cloudy-day.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/partly-cloudy-day.imageset/partly-cloudy-day.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/partly-cloudy-day.imageset/partly-cloudy-day.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/partly-cloudy-night.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "partly-cloudy-night.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/partly-cloudy-night.imageset/partly-cloudy-night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/partly-cloudy-night.imageset/partly-cloudy-night.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/rain.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "rain.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/rain.imageset/rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/rain.imageset/rain.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/sleet.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "sleet.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/sleet.imageset/sleet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/sleet.imageset/sleet.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/snow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "snow.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/snow.imageset/snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/snow.imageset/snow.png -------------------------------------------------------------------------------- /Weather/Assets.xcassets/wind.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "wind.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Weather/Assets.xcassets/wind.imageset/wind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/Weather/Assets.xcassets/wind.imageset/wind.png -------------------------------------------------------------------------------- /Weather/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Weather/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UISceneConfigurationName 35 | Default Configuration 36 | UISceneDelegateClassName 37 | $(PRODUCT_MODULE_NAME).SceneDelegate 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Weather/Model/Coordinate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Coordinate.swift 3 | // WeatherApp 4 | // 5 | // Created by Bobby Conti on 4/23/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Coordinate { 12 | let latitude: Double 13 | let longitude: Double 14 | } 15 | 16 | extension Coordinate: CustomStringConvertible { 17 | var description: String { 18 | return "\(latitude),\(longitude)" 19 | } 20 | 21 | static var newYorkCity: Coordinate { 22 | return Coordinate(latitude: 40.7128, longitude: -74.0060) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Weather/Model/CurrentWeather.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CurrentWeather.swift 3 | // WeatherApp 4 | // 5 | // Created by Bobby Conti on 4/23/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct CurrentWeather: Codable { 12 | let time: Double 13 | let summary: String 14 | let icon: String 15 | let precipProbability: Double 16 | let temperature: Double 17 | let apparentTemperature: Double 18 | let humidity: Double 19 | let windSpeed: Double 20 | 21 | init() { 22 | self.time = 0 23 | self.summary = "Data Unavailable" 24 | self.icon = "default" 25 | self.precipProbability = 0 26 | self.temperature = 0 27 | self.apparentTemperature = 0 28 | self.humidity = 0 29 | self.windSpeed = 0 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Weather/Model/DailyWeather.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DailyWeather.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct DailyWeather: Codable { 12 | let data: [Data] 13 | 14 | struct Data: Codable { 15 | let time: Double 16 | let temperatureHigh: Double 17 | let temperatureLow: Double 18 | let icon: String 19 | } 20 | 21 | init() { 22 | self.data = [Data]() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Weather/Model/Weather.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Weather.swift 3 | // WeatherApp 4 | // 5 | // Created by Bobby Conti on 4/23/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Weather: Codable { 12 | let currently: CurrentWeather 13 | let daily: DailyWeather 14 | 15 | init() { 16 | self.currently = CurrentWeather() 17 | self.daily = DailyWeather() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Weather/Networking/DarkSkyAPIClient.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DarkSkyAPIClient.swift 3 | // WeatherApp 4 | // 5 | // Created by Bobby Conti on 4/23/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class DarkSkyAPIClient { 12 | fileprivate let darkSkyApiKey = "YOURAPIKEY" 13 | 14 | lazy var baseUrl: URL = { 15 | return URL(string: "https://api.darksky.net/forecast/\(self.darkSkyApiKey)/")! 16 | }() 17 | 18 | let decoder = JSONDecoder() 19 | let session: URLSession 20 | 21 | init(configuration: URLSessionConfiguration) { 22 | self.session = URLSession(configuration: configuration) 23 | } 24 | 25 | convenience init() { 26 | self.init(configuration: .default) 27 | } 28 | 29 | typealias WeatherCompletionHandler = (Weather?, Error?) -> Void 30 | typealias CurrentWeatherCompletionHandler = (CurrentWeather?, Error?) -> Void 31 | typealias DailyWeatherCompletionHandler = (DailyWeather?, Error?) -> Void 32 | 33 | func getWeather(at coordinate: Coordinate, completionHandler completion: @escaping WeatherCompletionHandler) { 34 | 35 | guard let url = URL(string: coordinate.description, relativeTo: baseUrl) else { 36 | completion(nil, DarkSkyError.invalidURL) 37 | return 38 | } 39 | 40 | let request = URLRequest(url: url) 41 | 42 | let task = session.dataTask(with: request) { data, response, error in 43 | DispatchQueue.main.async { 44 | if let data = data { 45 | guard let httpResponse = response as? HTTPURLResponse else { 46 | completion(nil, DarkSkyError.requestFailed) 47 | return 48 | } 49 | 50 | if httpResponse.statusCode == 200 { 51 | do { 52 | let weather = try self.decoder.decode(Weather.self, from: data) 53 | completion(weather, nil) 54 | } catch let error { 55 | completion(nil, error) 56 | } 57 | } else { 58 | completion(nil, DarkSkyError.invalidData) 59 | } 60 | } else if let error = error { 61 | completion(nil, error) 62 | } 63 | } 64 | } 65 | 66 | task.resume() 67 | } 68 | 69 | func getCurrentWeather(at coordinate: Coordinate, completionHandler completion: @escaping CurrentWeatherCompletionHandler) { 70 | getWeather(at: coordinate) { weather, error in 71 | completion(weather?.currently, error) 72 | } 73 | } 74 | /* 75 | 76 | func getDailyWeather(at coordinate: Coordinate, completionHandler completion: @escaping DailyWeatherCompletionHandler) { 77 | getWeather(at: coordinate) { weather, error in 78 | completion(weather?.daily, error) 79 | } 80 | } 81 | */ 82 | } 83 | -------------------------------------------------------------------------------- /Weather/Networking/DarkSkyError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DarkSkyError.swift 3 | // WeatherApp 4 | // 5 | // Created by Bobby Conti on 4/23/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum DarkSkyError: Error { 12 | case requestFailed 13 | case responseUnsuccessful(statusCode: Int) 14 | case invalidData 15 | case jsonParsingFailure 16 | case invalidURL 17 | } 18 | -------------------------------------------------------------------------------- /Weather/Networking/NetworkManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkManager.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/12/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Combine 11 | 12 | class NetworkManager: BindableObject { 13 | var didChange = PassthroughSubject() 14 | 15 | var currentWeather = CurrentWeatherViewModel() { 16 | didSet { 17 | didChange.send(self) 18 | } 19 | } 20 | 21 | var dailyWeather = DailyWeatherViewModel() { 22 | didSet { 23 | didChange.send(self) 24 | } 25 | } 26 | 27 | let client = DarkSkyAPIClient() 28 | 29 | init() { 30 | client.getWeather(at: .newYorkCity) { weather, error in 31 | if let weather = weather { 32 | self.currentWeather = CurrentWeatherViewModel(model: weather.currently) 33 | self.dailyWeather = DailyWeatherViewModel(model: weather.daily) 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Weather/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Weather/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | 22 | // Use a UIHostingController as window root view controller 23 | let window = UIWindow(frame: UIScreen.main.bounds) 24 | window.rootViewController = UIHostingController(rootView: ContentView()) 25 | self.window = window 26 | window.makeKeyAndVisible() 27 | } 28 | 29 | func sceneDidDisconnect(_ scene: UIScene) { 30 | // Called as the scene is being released by the system. 31 | // This occurs shortly after the scene enters the background, or when its session is discarded. 32 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 33 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 34 | } 35 | 36 | func sceneDidBecomeActive(_ scene: UIScene) { 37 | // Called when the scene has moved from an inactive state to an active state. 38 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 39 | } 40 | 41 | func sceneWillResignActive(_ scene: UIScene) { 42 | // Called when the scene will move from an active state to an inactive state. 43 | // This may occur due to temporary interruptions (ex. an incoming phone call). 44 | } 45 | 46 | func sceneWillEnterForeground(_ scene: UIScene) { 47 | // Called as the scene transitions from the background to the foreground. 48 | // Use this method to undo the changes made on entering the background. 49 | } 50 | 51 | func sceneDidEnterBackground(_ scene: UIScene) { 52 | // Called as the scene transitions from the foreground to the background. 53 | // Use this method to save data, release shared resources, and store enough scene-specific state information 54 | // to restore the scene back to its current state. 55 | } 56 | 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Weather/View Model/CurrentWeatherViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CurrentWeatherViewModel.swift 3 | // WeatherApp 4 | // 5 | // Created by Bobby Conti on 4/23/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct CurrentWeatherViewModel { 12 | let time: String 13 | let summary: String 14 | let icon: String 15 | let precipProbability: String 16 | let temperature: String 17 | let apparentTemperature: String 18 | let humidity: String 19 | let windSpeed: String 20 | 21 | init() { 22 | self.time = "--" 23 | self.summary = "Data Unavailable" 24 | self.icon = "default" 25 | self.precipProbability = "--" 26 | self.temperature = "--" 27 | self.apparentTemperature = "--" 28 | self.humidity = "--" 29 | self.windSpeed = "--" 30 | } 31 | 32 | init(model: CurrentWeather) { 33 | let today = Date(timeIntervalSince1970: model.time) 34 | let formatter = DateFormatter() 35 | formatter.dateFormat = "EEEE, MMMM d" 36 | self.time = formatter.string(from: today) 37 | 38 | self.summary = model.summary 39 | 40 | self.icon = model.icon 41 | 42 | let precipPercentValue = Int(model.precipProbability * 100) 43 | self.precipProbability = "\(precipPercentValue)%" 44 | 45 | let roundedTemperature = Int(model.temperature) 46 | self.temperature = "\(roundedTemperature)º" 47 | 48 | let roundedApparentTemp = Int(model.apparentTemperature) 49 | self.apparentTemperature = "\(roundedApparentTemp)º" 50 | 51 | let humidityPercentValue = Int(model.humidity * 100) 52 | self.humidity = "\(humidityPercentValue)%" 53 | 54 | let roundedWindSpeed = Int(model.windSpeed) 55 | self.windSpeed = "\(roundedWindSpeed) mph" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Weather/View Model/DailyWeatherViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DailyWeatherViewModel.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct DailyWeatherViewModel { 12 | var data: [Data] 13 | 14 | struct Data { 15 | var day: String 16 | var temperatureHigh: String 17 | var temperatureLow: String 18 | var icon: String 19 | } 20 | 21 | init() { 22 | self.data = [Data]() 23 | } 24 | 25 | init(model: DailyWeather) { 26 | self.init() 27 | 28 | for index in 1...5 { 29 | let date = Date(timeIntervalSince1970: model.data[index].time) 30 | let formatter = DateFormatter() 31 | formatter.dateFormat = "EEEE" 32 | let formattedDay = formatter.string(from: date) 33 | 34 | let roundedHighTemperature = Int(model.data[index].temperatureHigh) 35 | let formattedTemperatureHigh = "\(roundedHighTemperature)º" 36 | 37 | let roundedLowTemperature = Int(model.data[index].temperatureLow) 38 | let formattedTemperatureLow = "\(roundedLowTemperature)º" 39 | 40 | let formattedIcon = model.data[index].icon 41 | 42 | self.data.append(Data(day: formattedDay, temperatureHigh: formattedTemperatureHigh, temperatureLow: formattedTemperatureLow, icon: formattedIcon)) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Weather/View/BackgroundView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundView.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/15/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct BackgroundView: View { 12 | var body: some View { 13 | let colorScheme = [Color.black, 14 | Color(red: 20/255, green: 31/255, blue: 78/255), 15 | Color(red: 141/255, green: 87/255, blue: 151/255)] 16 | 17 | let gradient = Gradient(colors: colorScheme) 18 | let linearGradient = LinearGradient(gradient: gradient, startPoint: .top, endPoint: .bottom) 19 | 20 | let background = Rectangle() 21 | .fill(linearGradient) 22 | .blur(radius: 200, opaque: true) 23 | .edgesIgnoringSafeArea(.all) 24 | 25 | return background 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Weather/View/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Combine 11 | 12 | struct ContentView: View { 13 | @State var networkManager = NetworkManager() 14 | 15 | var body: some View { 16 | ZStack { 17 | BackgroundView() 18 | 19 | VStack { 20 | HeaderView(data: networkManager.currentWeather) 21 | 22 | Spacer() 23 | 24 | CurrentWeatherView(data: networkManager.currentWeather) 25 | .padding([.leading, .trailing]) 26 | 27 | Spacer() 28 | 29 | DailyWeatherView(data: networkManager.dailyWeather) 30 | 31 | FooterView() 32 | } 33 | }.colorScheme(.dark) 34 | } 35 | } 36 | 37 | #if DEBUG 38 | struct ContentView_Previews : PreviewProvider { 39 | static var previews: some View { 40 | ContentView() 41 | } 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /Weather/View/CurrentWeatherView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CurrentWeatherView.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct CurrentWeatherView: View { 12 | let data: CurrentWeatherViewModel 13 | 14 | var body: some View { 15 | VStack(alignment: .leading) { 16 | HStack { 17 | Image(data.icon) 18 | .resizable() 19 | .frame(width: 40, height: 40) 20 | 21 | Text(data.summary) 22 | .font(.title) 23 | .fontWeight(.light) 24 | }.padding(0) 25 | 26 | HStack { 27 | Text(data.temperature) 28 | .font(.system(size: 150)) 29 | .fontWeight(.ultraLight) 30 | 31 | VStack(alignment: .leading) { 32 | HStack { 33 | Text("FEELS LIKE") 34 | Spacer() 35 | Text(data.apparentTemperature) 36 | }.padding(.bottom, 1) 37 | 38 | HStack { 39 | Text("WIND SPEED") 40 | Spacer() 41 | Text(data.windSpeed) 42 | }.padding(.bottom, 1) 43 | 44 | HStack { 45 | Text("HUMIDITY") 46 | Spacer() 47 | Text(data.humidity) 48 | }.padding(.bottom, 1) 49 | 50 | HStack { 51 | Text("PRECIPITATION") 52 | Spacer() 53 | Text(data.precipProbability) 54 | }.padding(.bottom, 1) 55 | }.font(.caption) 56 | }.padding(0) 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Weather/View/DailyWeatherView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DailyWeatherView.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/10/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct DailyWeatherView: View { 12 | let data: DailyWeatherViewModel 13 | 14 | var body: some View { 15 | VStack { 16 | HStack { 17 | Text("5-Day Forecast") 18 | .color(.gray) 19 | 20 | Spacer() 21 | }.padding(.leading) 22 | 23 | Divider() 24 | .padding([.leading, .trailing]) 25 | 26 | ForEach(data.data.identified(by: \.day)) { data in 27 | ZStack { 28 | HStack { 29 | Text(data.day) 30 | Spacer() 31 | Text(data.temperatureHigh).padding(8) 32 | Text(data.temperatureLow).color(.gray) 33 | }.padding([.leading, .trailing]) 34 | 35 | Image(data.icon) 36 | .resizable() 37 | .aspectRatio(UIImage(named: data.icon)!.size, contentMode: .fit) 38 | .frame(width: 50, height: 25) 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Weather/View/FooterView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FooterView.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/17/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct FooterView: View { 12 | var body: some View { 13 | Image("dark-sky-logo") 14 | .resizable() 15 | .frame(width: 120, height: 50) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Weather/View/HeaderView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HeaderView.swift 3 | // Weather 4 | // 5 | // Created by Bobby Conti on 6/17/19. 6 | // Copyright © 2019 Bobby Conti. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct HeaderView: View { 12 | let data: CurrentWeatherViewModel 13 | 14 | var body: some View { 15 | VStack { 16 | Text("NEW YORK CITY").font(.title).fontWeight(.light) 17 | Text(data.time).color(.gray) 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contirobert/Weather-SwiftUI/d1a10b2fd58e7f192df1ca9692bda62f4d08d33e/screenshot1.png --------------------------------------------------------------------------------