diff --git a/Swift Weather Instant/Info.plist b/Swift Weather Instant/Info.plist new file mode 100644 index 0000000..a0d9ab7 --- /dev/null +++ b/Swift Weather Instant/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Swift Weather Instant + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.rushjet.Swift-Weather.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSExtension + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.widget-extension + + + diff --git a/Swift Weather Instant/MainInterface.storyboard b/Swift Weather Instant/MainInterface.storyboard new file mode 100644 index 0000000..871694a --- /dev/null +++ b/Swift Weather Instant/MainInterface.storyboard @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Swift Weather Instant/Swift Weather Instant-Bridging-Header.h b/Swift Weather Instant/Swift Weather Instant-Bridging-Header.h new file mode 100644 index 0000000..6de8b15 --- /dev/null +++ b/Swift Weather Instant/Swift Weather Instant-Bridging-Header.h @@ -0,0 +1,5 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import \ No newline at end of file diff --git a/Swift Weather Instant/TodayViewController.swift b/Swift Weather Instant/TodayViewController.swift new file mode 100644 index 0000000..78201f5 --- /dev/null +++ b/Swift Weather Instant/TodayViewController.swift @@ -0,0 +1,274 @@ +// +// TodayViewController.swift +// Swift Weather Instant +// +// Created by Marc Tarnutzer on 12.12.14. +// Copyright (c) 2014 rushjet. All rights reserved. +// + +import UIKit +import NotificationCenter +import CoreLocation + +class TodayViewController: UIViewController, NCWidgetProviding, CLLocationManagerDelegate { + + let locationManager:CLLocationManager = CLLocationManager() + + @IBOutlet weak var time1: UILabel! + @IBOutlet weak var time2: UILabel! + @IBOutlet weak var time3: UILabel! + @IBOutlet weak var time4: UILabel! + @IBOutlet weak var image1: UIImageView! + @IBOutlet weak var image2: UIImageView! + @IBOutlet weak var image3: UIImageView! + @IBOutlet weak var image4: UIImageView! + @IBOutlet weak var temp1: UILabel! + @IBOutlet weak var temp2: UILabel! + @IBOutlet weak var temp3: UILabel! + @IBOutlet weak var temp4: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + + locationManager.delegate = self + locationManager.desiredAccuracy = kCLLocationAccuracyBest + + if ( ios8() ) { + locationManager.requestAlwaysAuthorization() + } + locationManager.startUpdatingLocation() + } + + func updateWeatherInfo(latitude: CLLocationDegrees, longitude: CLLocationDegrees) { + let manager = AFHTTPRequestOperationManager() + + let url = "http://api.openweathermap.org/data/2.5/forecast" + println(url) + + let params = ["lat":latitude, "lon":longitude] + println(params) + + manager.GET(url, + parameters: params, + success: { (operation: AFHTTPRequestOperation!, + responseObject: AnyObject!) in + //println("JSON: " + responseObject.description!) + + self.updateUISuccess(responseObject as NSDictionary!) + }, + failure: { (operation: AFHTTPRequestOperation!, + error: NSError!) in + println("Error: " + error.localizedDescription) + + }) + } + + func updateUISuccess(jsonResult: NSDictionary) { + + if let tempResult = ((jsonResult["list"]? as NSArray)[0]["main"] as NSDictionary)["temp"] as? Double { + // If we can get the temperature from JSON correctly, we assume the rest of JSON is correct. + var temperature: Double + var cntry: String + cntry = "" + + if let weatherArray = (jsonResult["list"]? as? NSArray) { + for index in 1...4 { + if let perTime = (weatherArray[index] as? NSDictionary) { + if let main = (perTime["main"]? as? NSDictionary) { + var temp = (main["temp"] as Double) + if (cntry == "US") { + // Convert temperature to Fahrenheit if user is within the US + temperature = round(((temp - 273.15) * 1.8) + 32) + } + else { + // Otherwise, convert temperature to Celsius + temperature = round(temp - 273.15) + } + + if (index==1) { + self.temp1.text = "\(temperature)°" + } + if (index==2) { + self.temp2.text = "\(temperature)°" + } + if (index==3) { + self.temp3.text = "\(temperature)°" + } + if (index==4) { + self.temp4.text = "\(temperature)°" + } + } + var dateFormatter = NSDateFormatter() + dateFormatter.dateFormat = "HH:mm" + if let date = (perTime["dt"]? as? Double) { + let thisDate = NSDate(timeIntervalSince1970: date) + let forecastTime = dateFormatter.stringFromDate(thisDate) + if (index==1) { + self.time1.text = forecastTime + } + if (index==2) { + self.time2.text = forecastTime + } + if (index==3) { + self.time3.text = forecastTime + } + if (index==4) { + self.time4.text = forecastTime + } + } + if let weather = (perTime["weather"]? as? NSArray) { + var condition = (weather[0] as NSDictionary)["id"] as Int + var icon = (weather[0] as NSDictionary)["icon"] as String + var nightTime = false + if icon.rangeOfString("n") != nil{ + nightTime = true + } + self.updateWeatherIcon(condition, nightTime: nightTime, index: index) + if (index==4) { + return + } + + } + } + } + } + } + } + + func updatePictures(index: Int, name: String) { + + if (index==1) { + self.image1.image = UIImage(named: name) + } + if (index==2) { + self.image2.image = UIImage(named: name) + } + if (index==3) { + self.image3.image = UIImage(named: name) + } + if (index==4) { + self.image4.image = UIImage(named: name) + } + } + + func updateWeatherIcon(condition: Int, nightTime: Bool, index: Int) { + // Thunderstorm + + var images = [self.image1.image, self.image2.image, self.image3.image, self.image4.image] + + if (condition < 300) { + if nightTime { + self.updatePictures(index, name: "tstorm1_night") + } else { + self.updatePictures(index, name: "tstorm1") + } + } + // Drizzle + else if (condition < 500) { + self.updatePictures(index, name: "light_rain") + + } + // Rain / Freezing rain / Shower rain + else if (condition < 600) { + self.updatePictures(index, name: "shower3") + } + // Snow + else if (condition < 700) { + self.updatePictures(index, name: "snow4") + } + // Fog / Mist / Haze / etc. + else if (condition < 771) { + if nightTime { + self.updatePictures(index, name: "fog_night") + } else { + self.updatePictures(index, name: "fog") + } + } + // Tornado / Squalls + else if (condition < 800) { + self.updatePictures(index, name: "tstorm3") + } + // Sky is clear + else if (condition == 800) { + if (nightTime){ + self.updatePictures(index, name: "sunny_night") + } + else { + self.updatePictures(index, name: "sunny") + } + } + // few / scattered / broken clouds + else if (condition < 804) { + if (nightTime){ + self.updatePictures(index, name: "cloudy2_night") + } + else{ + self.updatePictures(index, name: "cloudy2") + } + } + // overcast clouds + else if (condition == 804) { + self.updatePictures(index, name: "overcast") + } + // Extreme + else if ((condition >= 900 && condition < 903) || (condition > 904 && condition < 1000)) { + self.updatePictures(index, name: "tstorm3") + } + // Cold + else if (condition == 903) { + self.updatePictures(index, name: "snow5") + } + // Hot + else if (condition == 904) { + self.updatePictures(index, name: "sunny") + } + // Weather condition is not available + else { + self.updatePictures(index, name: "dunno") + } + } + + /* + iOS 8 Utility + */ + func ios8() -> Bool { + if ( NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1 ) { + return false + } else { + return true + } + } + + //CLLocationManagerDelegate + func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) { + var location:CLLocation = locations[locations.count-1] as CLLocation + + if (location.horizontalAccuracy > 0) { + self.locationManager.stopUpdatingLocation() + println(location.coordinate) + updateWeatherInfo(location.coordinate.latitude, longitude: location.coordinate.longitude) + } + } + + func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) { + println(error) + } + + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)!) { + // Perform any setup necessary in order to update the view. + + // If an error is encountered, use NCUpdateResult.Failed + // If there's no update required, use NCUpdateResult.NoData + // If there's an update, use NCUpdateResult.NewData + + locationManager.startUpdatingLocation() + completionHandler(NCUpdateResult.NewData) + } + +} diff --git a/Swift Weather.xcodeproj/project.pbxproj b/Swift Weather.xcodeproj/project.pbxproj index 0d88881..ed86fcb 100644 --- a/Swift Weather.xcodeproj/project.pbxproj +++ b/Swift Weather.xcodeproj/project.pbxproj @@ -13,6 +13,12 @@ 232FF1B9193F320D007015C4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 232FF1B7193F320D007015C4 /* Main.storyboard */; }; 232FF1BB193F320D007015C4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 232FF1BA193F320D007015C4 /* Images.xcassets */; }; 232FF1C7193F320D007015C4 /* Swift_WeatherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232FF1C6193F320D007015C4 /* Swift_WeatherTests.swift */; }; + 3442BAAF1A3BE73400139CDC /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3442BAAE1A3BE73400139CDC /* libPods.a */; }; + 3442BAB31A3BF5D300139CDC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 232FF1BA193F320D007015C4 /* Images.xcassets */; }; + 344C735C1A3B92A4002CB13B /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344C735B1A3B92A4002CB13B /* NotificationCenter.framework */; }; + 344C73611A3B92A4002CB13B /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 344C73601A3B92A4002CB13B /* TodayViewController.swift */; }; + 344C73631A3B92A4002CB13B /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 344C73621A3B92A4002CB13B /* MainInterface.storyboard */; }; + 344C73661A3B92A4002CB13B /* Swift Weather Instant.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 344C735A1A3B92A4002CB13B /* Swift Weather Instant.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; E10D3FA5194A170F00769A84 /* Cloud-Refresh.png in Resources */ = {isa = PBXBuildFile; fileRef = E10D3FA4194A170F00769A84 /* Cloud-Refresh.png */; }; E12DE1EB194A0CFF00056102 /* background_summer.png in Resources */ = {isa = PBXBuildFile; fileRef = E12DE1EA194A0CFF00056102 /* background_summer.png */; }; E1A5708D194A11F700708955 /* tstorm1_night.png in Resources */ = {isa = PBXBuildFile; fileRef = E1A5708B194A11F700708955 /* tstorm1_night.png */; }; @@ -41,8 +47,29 @@ remoteGlobalIDString = 232FF1AD193F320D007015C4; remoteInfo = "Swift Weather"; }; + 344C73641A3B92A4002CB13B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 232FF1A6193F320C007015C4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 344C73591A3B92A4002CB13B; + remoteInfo = "Swift Weather Instant"; + }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 344C736A1A3B92A4002CB13B /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 344C73661A3B92A4002CB13B /* Swift Weather Instant.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 232FF1AE193F320D007015C4 /* Swift Weather.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Swift Weather.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 232FF1B2193F320D007015C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -54,6 +81,13 @@ 232FF1C5193F320D007015C4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 232FF1C6193F320D007015C4 /* Swift_WeatherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Swift_WeatherTests.swift; sourceTree = ""; }; 232FF1D0193F3346007015C4 /* SwiftWeather-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftWeather-Bridging-Header.h"; sourceTree = ""; }; + 3442BAAE1A3BE73400139CDC /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "Pods/build/Debug-iphoneos/libPods.a"; sourceTree = ""; }; + 3442BAB01A3BE88A00139CDC /* Swift Weather Instant-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Swift Weather Instant-Bridging-Header.h"; sourceTree = ""; }; + 344C735A1A3B92A4002CB13B /* Swift Weather Instant.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Swift Weather Instant.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + 344C735B1A3B92A4002CB13B /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; + 344C735F1A3B92A4002CB13B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 344C73601A3B92A4002CB13B /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; + 344C73621A3B92A4002CB13B /* MainInterface.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = ""; }; 398F769C3A054C82877812B1 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; AAAAA7E8A1CE4203A7844823 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; E10D3FA4194A170F00769A84 /* Cloud-Refresh.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Cloud-Refresh.png"; sourceTree = ""; }; @@ -92,13 +126,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 344C73571A3B92A4002CB13B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3442BAAF1A3BE73400139CDC /* libPods.a in Frameworks */, + 344C735C1A3B92A4002CB13B /* NotificationCenter.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 128ACBBD2E004856867FDAD7 /* Frameworks */ = { isa = PBXGroup; children = ( + 3442BAAE1A3BE73400139CDC /* libPods.a */, 398F769C3A054C82877812B1 /* libPods.a */, + 344C735B1A3B92A4002CB13B /* NotificationCenter.framework */, ); name = Frameworks; sourceTree = ""; @@ -131,6 +176,7 @@ children = ( 232FF1B0193F320D007015C4 /* Swift Weather */, 232FF1C3193F320D007015C4 /* Swift WeatherTests */, + 344C735D1A3B92A4002CB13B /* Swift Weather Instant */, 232FF1AF193F320D007015C4 /* Products */, AAAAA7E8A1CE4203A7844823 /* Pods.xcconfig */, 128ACBBD2E004856867FDAD7 /* Frameworks */, @@ -142,6 +188,7 @@ children = ( 232FF1AE193F320D007015C4 /* Swift Weather.app */, 232FF1C0193F320D007015C4 /* Swift WeatherTests.xctest */, + 344C735A1A3B92A4002CB13B /* Swift Weather Instant.appex */, ); name = Products; sourceTree = ""; @@ -187,6 +234,25 @@ name = "Supporting Files"; sourceTree = ""; }; + 344C735D1A3B92A4002CB13B /* Swift Weather Instant */ = { + isa = PBXGroup; + children = ( + 344C73601A3B92A4002CB13B /* TodayViewController.swift */, + 344C73621A3B92A4002CB13B /* MainInterface.storyboard */, + 344C735E1A3B92A4002CB13B /* Supporting Files */, + 3442BAB01A3BE88A00139CDC /* Swift Weather Instant-Bridging-Header.h */, + ); + path = "Swift Weather Instant"; + sourceTree = ""; + }; + 344C735E1A3B92A4002CB13B /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 344C735F1A3B92A4002CB13B /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -199,10 +265,12 @@ 232FF1AB193F320D007015C4 /* Frameworks */, 232FF1AC193F320D007015C4 /* Resources */, D599F504738F419D978D2F6C /* Copy Pods Resources */, + 344C736A1A3B92A4002CB13B /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + 344C73651A3B92A4002CB13B /* PBXTargetDependency */, ); name = "Swift Weather"; productName = "Swift Weather"; @@ -227,6 +295,23 @@ productReference = 232FF1C0193F320D007015C4 /* Swift WeatherTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 344C73591A3B92A4002CB13B /* Swift Weather Instant */ = { + isa = PBXNativeTarget; + buildConfigurationList = 344C73691A3B92A4002CB13B /* Build configuration list for PBXNativeTarget "Swift Weather Instant" */; + buildPhases = ( + 344C73561A3B92A4002CB13B /* Sources */, + 344C73571A3B92A4002CB13B /* Frameworks */, + 344C73581A3B92A4002CB13B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Swift Weather Instant"; + productName = "Swift Weather Instant"; + productReference = 344C735A1A3B92A4002CB13B /* Swift Weather Instant.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -245,6 +330,10 @@ DevelopmentTeam = 964HJ5SV2F; TestTargetID = 232FF1AD193F320D007015C4; }; + 344C73591A3B92A4002CB13B = { + CreatedOnToolsVersion = 6.1.1; + DevelopmentTeam = 964HJ5SV2F; + }; }; }; buildConfigurationList = 232FF1A9193F320D007015C4 /* Build configuration list for PBXProject "Swift Weather" */; @@ -262,6 +351,7 @@ targets = ( 232FF1AD193F320D007015C4 /* Swift Weather */, 232FF1BF193F320D007015C4 /* Swift WeatherTests */, + 344C73591A3B92A4002CB13B /* Swift Weather Instant */, ); }; /* End PBXProject section */ @@ -301,6 +391,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 344C73581A3B92A4002CB13B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 344C73631A3B92A4002CB13B /* MainInterface.storyboard in Resources */, + 3442BAB31A3BF5D300139CDC /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -354,6 +453,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 344C73561A3B92A4002CB13B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 344C73611A3B92A4002CB13B /* TodayViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -362,6 +469,11 @@ target = 232FF1AD193F320D007015C4 /* Swift Weather */; targetProxy = 232FF1C1193F320D007015C4 /* PBXContainerItemProxy */; }; + 344C73651A3B92A4002CB13B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 344C73591A3B92A4002CB13B /* Swift Weather Instant */; + targetProxy = 344C73641A3B92A4002CB13B /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -459,6 +571,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "Swift Weather/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -473,6 +586,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "Swift Weather/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -523,6 +637,49 @@ }; name = Release; }; + 344C73671A3B92A4002CB13B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AAAAA7E8A1CE4203A7844823 /* Pods.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "Swift Weather Instant/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/build/Debug-iphoneos", + ); + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = "Swift Weather Instant/Swift Weather Instant-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 344C73681A3B92A4002CB13B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AAAAA7E8A1CE4203A7844823 /* Pods.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + INFOPLIST_FILE = "Swift Weather Instant/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/build/Debug-iphoneos", + ); + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = "Swift Weather Instant/Swift Weather Instant-Bridging-Header.h"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -553,6 +710,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 344C73691A3B92A4002CB13B /* Build configuration list for PBXNativeTarget "Swift Weather Instant" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 344C73671A3B92A4002CB13B /* Debug */, + 344C73681A3B92A4002CB13B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 232FF1A6193F320C007015C4 /* Project object */; diff --git a/Swift Weather/Base.lproj/Main.storyboard b/Swift Weather/Base.lproj/Main.storyboard index 8daaa8f..75cdc8a 100644 --- a/Swift Weather/Base.lproj/Main.storyboard +++ b/Swift Weather/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Contents.json b/Swift Weather/Images.xcassets/AppIcon.appiconset/Contents.json index a396706..79c8882 100644 --- a/Swift Weather/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Swift Weather/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,18 +1,88 @@ { "images" : [ { + "size" : "29x29", "idiom" : "iphone", + "filename" : "Icon-29.png", + "scale" : "1x" + }, + { "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-29@2x.png", "scale" : "2x" }, { + "size" : "29x29", "idiom" : "iphone", + "filename" : "Icon-29@3x.png", + "scale" : "3x" + }, + { "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-40@2x.png", "scale" : "2x" }, { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", "idiom" : "iphone", + "filename" : "Icon-60@2x.png", + "scale" : "2x" + }, + { "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@3x.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-40.png", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-76@2x.png", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "iTunesArtwork@2x.png", "scale" : "2x" } ], diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29.png new file mode 100644 index 0000000..5aff191 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png new file mode 100644 index 0000000..07b81d7 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png new file mode 100644 index 0000000..526f606 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40.png new file mode 100644 index 0000000..f4fc2f7 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png new file mode 100644 index 0000000..d4824cc Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png new file mode 100644 index 0000000..790bdab Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png new file mode 100644 index 0000000..790bdab Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png new file mode 100644 index 0000000..fa1fd20 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png new file mode 100644 index 0000000..a53afc9 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/Swift Weather/Images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png b/Swift Weather/Images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png new file mode 100644 index 0000000..91481c2 Binary files /dev/null and b/Swift Weather/Images.xcassets/AppIcon.appiconset/iTunesArtwork@2x.png differ diff --git a/Swift Weather/Images.xcassets/LaunchImage.launchimage/Contents.json b/Swift Weather/Images.xcassets/LaunchImage.launchimage/Contents.json index c79ebd3..fadb823 100644 --- a/Swift Weather/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/Swift Weather/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -10,9 +10,9 @@ { "orientation" : "portrait", "idiom" : "iphone", - "subtype" : "retina4", "extent" : "full-screen", "minimum-system-version" : "7.0", + "subtype" : "retina4", "scale" : "2x" } ], diff --git a/Swift Weather/Images.xcassets/cloudy2.imageset/Contents.json b/Swift Weather/Images.xcassets/cloudy2.imageset/Contents.json new file mode 100644 index 0000000..939179a --- /dev/null +++ b/Swift Weather/Images.xcassets/cloudy2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "cloudy2.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/cloudy2.imageset/cloudy2.png b/Swift Weather/Images.xcassets/cloudy2.imageset/cloudy2.png new file mode 100644 index 0000000..737fb19 Binary files /dev/null and b/Swift Weather/Images.xcassets/cloudy2.imageset/cloudy2.png differ diff --git a/Swift Weather/Images.xcassets/cloudy2_night.imageset/Contents.json b/Swift Weather/Images.xcassets/cloudy2_night.imageset/Contents.json new file mode 100644 index 0000000..0c5a58e --- /dev/null +++ b/Swift Weather/Images.xcassets/cloudy2_night.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "cloudy2_night.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/cloudy2_night.imageset/cloudy2_night.png b/Swift Weather/Images.xcassets/cloudy2_night.imageset/cloudy2_night.png new file mode 100644 index 0000000..130c4e5 Binary files /dev/null and b/Swift Weather/Images.xcassets/cloudy2_night.imageset/cloudy2_night.png differ diff --git a/Swift Weather/Images.xcassets/dunno.imageset/Contents.json b/Swift Weather/Images.xcassets/dunno.imageset/Contents.json new file mode 100644 index 0000000..c62fe51 --- /dev/null +++ b/Swift Weather/Images.xcassets/dunno.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "dunno.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/dunno.imageset/dunno.png b/Swift Weather/Images.xcassets/dunno.imageset/dunno.png new file mode 100644 index 0000000..fca43b8 Binary files /dev/null and b/Swift Weather/Images.xcassets/dunno.imageset/dunno.png differ diff --git a/Swift Weather/Images.xcassets/fog.imageset/Contents.json b/Swift Weather/Images.xcassets/fog.imageset/Contents.json new file mode 100644 index 0000000..5623282 --- /dev/null +++ b/Swift Weather/Images.xcassets/fog.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "fog.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/fog.imageset/fog.png b/Swift Weather/Images.xcassets/fog.imageset/fog.png new file mode 100644 index 0000000..6c3ba81 Binary files /dev/null and b/Swift Weather/Images.xcassets/fog.imageset/fog.png differ diff --git a/Swift Weather/Images.xcassets/fog_night.imageset/Contents.json b/Swift Weather/Images.xcassets/fog_night.imageset/Contents.json new file mode 100644 index 0000000..4e9d7a0 --- /dev/null +++ b/Swift Weather/Images.xcassets/fog_night.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "fog_night.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/fog_night.imageset/fog_night.png b/Swift Weather/Images.xcassets/fog_night.imageset/fog_night.png new file mode 100644 index 0000000..47128a9 Binary files /dev/null and b/Swift Weather/Images.xcassets/fog_night.imageset/fog_night.png differ diff --git a/Swift Weather/Images.xcassets/light_rain.imageset/Contents.json b/Swift Weather/Images.xcassets/light_rain.imageset/Contents.json new file mode 100644 index 0000000..e34a65a --- /dev/null +++ b/Swift Weather/Images.xcassets/light_rain.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "light_rain.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/light_rain.imageset/light_rain.png b/Swift Weather/Images.xcassets/light_rain.imageset/light_rain.png new file mode 100644 index 0000000..b3be5b8 Binary files /dev/null and b/Swift Weather/Images.xcassets/light_rain.imageset/light_rain.png differ diff --git a/Swift Weather/Images.xcassets/overcast.imageset/Contents.json b/Swift Weather/Images.xcassets/overcast.imageset/Contents.json new file mode 100644 index 0000000..c115ab0 --- /dev/null +++ b/Swift Weather/Images.xcassets/overcast.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "overcast.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/overcast.imageset/overcast.png b/Swift Weather/Images.xcassets/overcast.imageset/overcast.png new file mode 100644 index 0000000..18c18ee Binary files /dev/null and b/Swift Weather/Images.xcassets/overcast.imageset/overcast.png differ diff --git a/Swift Weather/Images.xcassets/shower3.imageset/Contents.json b/Swift Weather/Images.xcassets/shower3.imageset/Contents.json new file mode 100644 index 0000000..e3e90ea --- /dev/null +++ b/Swift Weather/Images.xcassets/shower3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "shower3.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/shower3.imageset/shower3.png b/Swift Weather/Images.xcassets/shower3.imageset/shower3.png new file mode 100644 index 0000000..67f992d Binary files /dev/null and b/Swift Weather/Images.xcassets/shower3.imageset/shower3.png differ diff --git a/Swift Weather/Images.xcassets/snow4.imageset/Contents.json b/Swift Weather/Images.xcassets/snow4.imageset/Contents.json new file mode 100644 index 0000000..1ccae15 --- /dev/null +++ b/Swift Weather/Images.xcassets/snow4.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "snow4.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/snow4.imageset/snow4.png b/Swift Weather/Images.xcassets/snow4.imageset/snow4.png new file mode 100644 index 0000000..3000a3c Binary files /dev/null and b/Swift Weather/Images.xcassets/snow4.imageset/snow4.png differ diff --git a/Swift Weather/Images.xcassets/snow5.imageset/Contents.json b/Swift Weather/Images.xcassets/snow5.imageset/Contents.json new file mode 100644 index 0000000..a570d45 --- /dev/null +++ b/Swift Weather/Images.xcassets/snow5.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "snow5.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/snow5.imageset/snow5.png b/Swift Weather/Images.xcassets/snow5.imageset/snow5.png new file mode 100644 index 0000000..0f5b793 Binary files /dev/null and b/Swift Weather/Images.xcassets/snow5.imageset/snow5.png differ diff --git a/Swift Weather/Images.xcassets/sunny.imageset/Contents.json b/Swift Weather/Images.xcassets/sunny.imageset/Contents.json new file mode 100644 index 0000000..0959dcb --- /dev/null +++ b/Swift Weather/Images.xcassets/sunny.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "sunny.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/sunny.imageset/sunny.png b/Swift Weather/Images.xcassets/sunny.imageset/sunny.png new file mode 100644 index 0000000..7304f86 Binary files /dev/null and b/Swift Weather/Images.xcassets/sunny.imageset/sunny.png differ diff --git a/Swift Weather/Images.xcassets/sunny_night.imageset/Contents.json b/Swift Weather/Images.xcassets/sunny_night.imageset/Contents.json new file mode 100644 index 0000000..2898ecd --- /dev/null +++ b/Swift Weather/Images.xcassets/sunny_night.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "sunny_night.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/sunny_night.imageset/sunny_night.png b/Swift Weather/Images.xcassets/sunny_night.imageset/sunny_night.png new file mode 100644 index 0000000..fcec655 Binary files /dev/null and b/Swift Weather/Images.xcassets/sunny_night.imageset/sunny_night.png differ diff --git a/Swift Weather/Images.xcassets/tstorm1.imageset/Contents.json b/Swift Weather/Images.xcassets/tstorm1.imageset/Contents.json new file mode 100644 index 0000000..5aaedd6 --- /dev/null +++ b/Swift Weather/Images.xcassets/tstorm1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "tstorm1.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/tstorm1.imageset/tstorm1.png b/Swift Weather/Images.xcassets/tstorm1.imageset/tstorm1.png new file mode 100644 index 0000000..407c894 Binary files /dev/null and b/Swift Weather/Images.xcassets/tstorm1.imageset/tstorm1.png differ diff --git a/Swift Weather/Images.xcassets/tstorm1_night.imageset/Contents.json b/Swift Weather/Images.xcassets/tstorm1_night.imageset/Contents.json new file mode 100644 index 0000000..5a39b2e --- /dev/null +++ b/Swift Weather/Images.xcassets/tstorm1_night.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "tstorm1_night.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/tstorm1_night.imageset/tstorm1_night.png b/Swift Weather/Images.xcassets/tstorm1_night.imageset/tstorm1_night.png new file mode 100644 index 0000000..41749e6 Binary files /dev/null and b/Swift Weather/Images.xcassets/tstorm1_night.imageset/tstorm1_night.png differ diff --git a/Swift Weather/Images.xcassets/tstorm3.imageset/Contents.json b/Swift Weather/Images.xcassets/tstorm3.imageset/Contents.json new file mode 100644 index 0000000..153cd26 --- /dev/null +++ b/Swift Weather/Images.xcassets/tstorm3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "tstorm3.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Swift Weather/Images.xcassets/tstorm3.imageset/tstorm3.png b/Swift Weather/Images.xcassets/tstorm3.imageset/tstorm3.png new file mode 100644 index 0000000..ebfe876 Binary files /dev/null and b/Swift Weather/Images.xcassets/tstorm3.imageset/tstorm3.png differ diff --git a/Swift Weather/ViewController.swift b/Swift Weather/ViewController.swift index d1f65e4..7eb2048 100644 --- a/Swift Weather/ViewController.swift +++ b/Swift Weather/ViewController.swift @@ -65,14 +65,14 @@ class ViewController: UIViewController, CLLocationManagerDelegate { let url = "http://api.openweathermap.org/data/2.5/forecast" println(url) - let params = ["lat":latitude, "lon":longitude, "cnt":0] + let params = ["lat":latitude, "lon":longitude] println(params) manager.GET(url, parameters: params, success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!) in - //println("JSON: " + responseObject.description!) + println("JSON: " + responseObject.description!) self.updateUISuccess(responseObject as NSDictionary!) }, @@ -90,7 +90,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate { self.loadingIndicator.stopAnimating() if let tempResult = ((jsonResult["list"]? as NSArray)[0]["main"] as NSDictionary)["temp"] as? Double { - + println("TempResult:", tempResult) // If we can get the temperature from JSON correctly, we assume the rest of JSON is correct. var temperature: Double var cntry: String @@ -121,6 +121,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate { if let weatherArray = (jsonResult["list"]? as? NSArray) { for index in 0...4 { + println(index) if let perTime = (weatherArray[index] as? NSDictionary) { if let main = (perTime["main"]? as? NSDictionary) { var temp = (main["temp"] as Double)