diff --git a/WeatherApp/.DS_Store b/WeatherApp/.DS_Store index d26d934..5d489ba 100644 Binary files a/WeatherApp/.DS_Store and b/WeatherApp/.DS_Store differ diff --git a/WeatherApp/WeatherApp.xcodeproj/project.pbxproj b/WeatherApp/WeatherApp.xcodeproj/project.pbxproj index cd17f80..263daa2 100644 --- a/WeatherApp/WeatherApp.xcodeproj/project.pbxproj +++ b/WeatherApp/WeatherApp.xcodeproj/project.pbxproj @@ -9,11 +9,14 @@ /* Begin PBXBuildFile section */ 0802D1FF1DE9DCAF00054425 /* DayForecastViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0802D1FE1DE9DCAF00054425 /* DayForecastViewController.swift */; }; 0802D2021DE9DEE700054425 /* WeatherState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0802D2011DE9DEE700054425 /* WeatherState.swift */; }; - 4D5C914D1E2CE3CD005D947F /* add_2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D5C914C1E2CE3CD005D947F /* add_2x.png */; }; 6D1F340E1DF84D0600714FD6 /* TodayViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D1F340D1DF84D0600714FD6 /* TodayViewCell.swift */; }; 843CFBA81E1FFFEF008463E6 /* menu.png in Resources */ = {isa = PBXBuildFile; fileRef = 843CFBA71E1FFFEF008463E6 /* menu.png */; }; 843CFBAA1E200469008463E6 /* CityPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 843CFBA91E200469008463E6 /* CityPickerViewController.swift */; }; 84E7C9A81E2970790027489E /* OpenWeatherMapService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E7C9A71E2970790027489E /* OpenWeatherMapService.swift */; }; + 84F717F41E301CEC002CF484 /* AvgTemp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F717F31E301CEC002CF484 /* AvgTemp.swift */; }; + 84F717F61E301CFE002CF484 /* BazierCurves.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F717F51E301CFE002CF484 /* BazierCurves.swift */; }; + 84F717F81E301D15002CF484 /* TemperatureWeekGraphViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F717F71E301D15002CF484 /* TemperatureWeekGraphViewController.swift */; }; + 84F717FA1E301F70002CF484 /* add_2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 84F717F91E301F70002CF484 /* add_2x.png */; }; 9D42497B1DBB8E0A00125040 /* ForecastMO+ForecastObjectProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D42497A1DBB8E0A00125040 /* ForecastMO+ForecastObjectProtocol.swift */; }; 9D6A14541DBA83EA00715576 /* CoreDataProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D6A14531DBA83EA00715576 /* CoreDataProtocol.swift */; }; 9D6A14561DBA85AD00715576 /* ProviderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D6A14551DBA85AD00715576 /* ProviderProtocol.swift */; }; @@ -47,11 +50,14 @@ /* Begin PBXFileReference section */ 0802D1FE1DE9DCAF00054425 /* DayForecastViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DayForecastViewController.swift; sourceTree = ""; }; 0802D2011DE9DEE700054425 /* WeatherState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeatherState.swift; sourceTree = ""; }; - 4D5C914C1E2CE3CD005D947F /* add_2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = add_2x.png; path = ../../../../../Downloads/ic_add_black_24dp/ios/ic_add.imageset/add_2x.png; sourceTree = ""; }; 6D1F340D1DF84D0600714FD6 /* TodayViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodayViewCell.swift; sourceTree = ""; }; 843CFBA71E1FFFEF008463E6 /* menu.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu.png; sourceTree = ""; }; 843CFBA91E200469008463E6 /* CityPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CityPickerViewController.swift; sourceTree = ""; }; 84E7C9A71E2970790027489E /* OpenWeatherMapService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenWeatherMapService.swift; sourceTree = ""; }; + 84F717F31E301CEC002CF484 /* AvgTemp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AvgTemp.swift; path = ../../Controller/AvgTemp.swift; sourceTree = ""; }; + 84F717F51E301CFE002CF484 /* BazierCurves.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BazierCurves.swift; sourceTree = ""; }; + 84F717F71E301D15002CF484 /* TemperatureWeekGraphViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TemperatureWeekGraphViewController.swift; sourceTree = ""; }; + 84F717F91E301F70002CF484 /* add_2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = add_2x.png; sourceTree = ""; }; 9D42497A1DBB8E0A00125040 /* ForecastMO+ForecastObjectProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "ForecastMO+ForecastObjectProtocol.swift"; path = "../../../Providers/ForecastMO+ForecastObjectProtocol.swift"; sourceTree = ""; }; 9D6A14531DBA83EA00715576 /* CoreDataProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataProtocol.swift; sourceTree = ""; }; 9D6A14551DBA85AD00715576 /* ProviderProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProviderProtocol.swift; sourceTree = ""; }; @@ -105,8 +111,8 @@ 843CFBA61E1FFFD8008463E6 /* Images */ = { isa = PBXGroup; children = ( + 84F717F91E301F70002CF484 /* add_2x.png */, 843CFBA71E1FFFEF008463E6 /* menu.png */, - 4D5C914C1E2CE3CD005D947F /* add_2x.png */, ); name = Images; sourceTree = ""; @@ -176,6 +182,8 @@ 9D859B171D9E32690055F23A /* Controller */ = { isa = PBXGroup; children = ( + 84F717F51E301CFE002CF484 /* BazierCurves.swift */, + 84F717F71E301D15002CF484 /* TemperatureWeekGraphViewController.swift */, 9D859B041D9E31D30055F23A /* ForecastViewController.swift */, AE7B62E41DE0242F00D32D4B /* SettingsTableViewController.swift */, 0802D1FE1DE9DCAF00054425 /* DayForecastViewController.swift */, @@ -247,6 +255,7 @@ 9DCF9BB31DBA4286007518CC /* Helpers */ = { isa = PBXGroup; children = ( + 84F717F31E301CEC002CF484 /* AvgTemp.swift */, 9DCF9BB41DBA4286007518CC /* Units.swift */, ); name = Helpers; @@ -336,7 +345,7 @@ 9D859B1D1D9E32A80055F23A /* Info.plist in Resources */, 843CFBA81E1FFFEF008463E6 /* menu.png in Resources */, 9D859B1F1D9E32DB0055F23A /* LaunchScreen.storyboard in Resources */, - 4D5C914D1E2CE3CD005D947F /* add_2x.png in Resources */, + 84F717FA1E301F70002CF484 /* add_2x.png in Resources */, 9D859B1C1D9E32A80055F23A /* Assets.xcassets in Resources */, 9D859B211D9E335D0055F23A /* Main.storyboard in Resources */, ); @@ -363,10 +372,13 @@ 9DCF9BC51DBA4286007518CC /* WeatherServiceProtocol.swift in Sources */, 9D42497B1DBB8E0A00125040 /* ForecastMO+ForecastObjectProtocol.swift in Sources */, 9DCF9BC21DBA4286007518CC /* WeatherModel.xcdatamodeld in Sources */, + 84F717F81E301D15002CF484 /* TemperatureWeekGraphViewController.swift in Sources */, + 84F717F61E301CFE002CF484 /* BazierCurves.swift in Sources */, AEC316EB1DE969B8006F9EE8 /* CustomLocationManager.swift in Sources */, 9D859B1B1D9E32A80055F23A /* AppDelegate.swift in Sources */, 0802D1FF1DE9DCAF00054425 /* DayForecastViewController.swift in Sources */, 9D859B051D9E31D30055F23A /* ForecastViewController.swift in Sources */, + 84F717F41E301CEC002CF484 /* AvgTemp.swift in Sources */, 9DCF9BBF1DBA4286007518CC /* ForecastMO+CoreDataProperties.swift in Sources */, AE7B62E51DE0242F00D32D4B /* SettingsTableViewController.swift in Sources */, 9DBD3EE11DBA961900ED8FEA /* YahooWeatherParser.swift in Sources */, diff --git a/WeatherApp/WeatherApp.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate b/WeatherApp/WeatherApp.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate index 51eadbf..308ce54 100644 Binary files a/WeatherApp/WeatherApp.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate and b/WeatherApp/WeatherApp.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/WeatherApp/WeatherApp/Controller/AvgTemp.swift b/WeatherApp/WeatherApp/Controller/AvgTemp.swift new file mode 100644 index 0000000..3f59229 --- /dev/null +++ b/WeatherApp/WeatherApp/Controller/AvgTemp.swift @@ -0,0 +1,11 @@ +// +// AvgTemp.swift +// WeatherApp +// +// Created by Admin on 18.01.17. +// Copyright © 2017 VSU. All rights reserved. +// + +import Foundation + +public var avgTemperatures = [Int]() diff --git a/WeatherApp/WeatherApp/Controller/BazierCurves.swift b/WeatherApp/WeatherApp/Controller/BazierCurves.swift new file mode 100644 index 0000000..c07f79a --- /dev/null +++ b/WeatherApp/WeatherApp/Controller/BazierCurves.swift @@ -0,0 +1,68 @@ +// +// BazierCurves.swift +// WeatherApp +// +// Created by Admin on 18.01.17. +// Copyright © 2017 VSU. All rights reserved. +// + +import UIKit + +class BazierCurves: UIView { + + override func draw(_ rect: CGRect) { + /*Drawing Axis*/ + let zeroDot: CGPoint = CGPoint(x: 5, y: self.bounds.height / 2) + + let axisPath = UIBezierPath() + axisPath.move(to: zeroDot) + + axisPath.addLine(to: CGPoint(x: self.bounds.width, y: self.bounds.height / 2)) + axisPath.move(to: zeroDot) + axisPath.addLine(to: CGPoint(x: 5, y: 0)) + axisPath.move(to: zeroDot) + axisPath.addLine(to: CGPoint(x: 5, y: self.bounds.height)) + axisPath.move(to: zeroDot) + + let blackColor = UIColor.black + blackColor.setStroke() + + axisPath.lineWidth = 3.0 + axisPath.stroke() + + /*Drawing temperature graph*/ + let leftDot: CGPoint = CGPoint(x: 5, y: self.bounds.height / 2 - CGFloat(avgTemperatures[0]) * 5.5) + + let dot1: CGPoint = CGPoint(x: self.bounds.width / 6, y: self.bounds.height / 2 - CGFloat(avgTemperatures[1]) * 5.5) + let dot2: CGPoint = CGPoint(x: 2*self.bounds.width / 6, y: self.bounds.height / 2 - CGFloat(avgTemperatures[2]) * 5.5) + let dot3: CGPoint = CGPoint(x: 3*self.bounds.width / 6, y: self.bounds.height / 2 - CGFloat(avgTemperatures[3]) * 5.5) + let dot4: CGPoint = CGPoint(x: 4*self.bounds.width / 6, y: self.bounds.height / 2 - CGFloat(avgTemperatures[4]) * 5.5) + let dot5: CGPoint = CGPoint(x: 5*self.bounds.width / 6, y: self.bounds.height / 2 - CGFloat(avgTemperatures[5]) * 5.5) + let dot6: CGPoint = CGPoint(x: self.bounds.width - 5, y: self.bounds.height / 2 - CGFloat(avgTemperatures[6]) * 5.5) + + let dropPath = UIBezierPath() + dropPath.move(to: leftDot) + + dropPath.addLine(to: dot1) + dropPath.move(to: dot1) + dropPath.addLine(to: dot2) + dropPath.move(to: dot2) + dropPath.addLine(to: dot3) + dropPath.move(to: dot3) + dropPath.addLine(to: dot4) + dropPath.move(to: dot4) + dropPath.addLine(to: dot5) + dropPath.move(to: dot5) + dropPath.addLine(to: dot6) + dropPath.move(to: dot6) + + + let blueColor = UIColor.blue + + blueColor.setStroke() + dropPath.lineWidth = 2.0 + + dropPath.stroke() + } + +} diff --git a/WeatherApp/WeatherApp/Controller/ForecastViewController.swift b/WeatherApp/WeatherApp/Controller/ForecastViewController.swift index 5913480..c9d5518 100644 --- a/WeatherApp/WeatherApp/Controller/ForecastViewController.swift +++ b/WeatherApp/WeatherApp/Controller/ForecastViewController.swift @@ -94,6 +94,9 @@ class ForecastViewController: UITableViewController, LocationDelegate, ProviderD if let forecast = provider!.object(atIndex: indexPath.section) { cell.textLabel?.text = forecast.textString cell.detailTextLabel?.text = forecast.temperatureString + if indexPath.section <= 7 { + avgTemperatures.append(forecast.averageTemperature) + } } return cell } diff --git a/WeatherApp/WeatherApp/Controller/TemperatureWeekGraphViewController.swift b/WeatherApp/WeatherApp/Controller/TemperatureWeekGraphViewController.swift new file mode 100644 index 0000000..d3ef70e --- /dev/null +++ b/WeatherApp/WeatherApp/Controller/TemperatureWeekGraphViewController.swift @@ -0,0 +1,25 @@ +// +// TemperatureWeekGraphViewController.swift +// WeatherApp +// +// Created by Admin on 17.01.17. +// Copyright © 2017 VSU. All rights reserved. +// + +import UIKit + +class TemperatureWeekGraphViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + +} + diff --git a/WeatherApp/WeatherApp/Supporting Files/add_2x.png b/WeatherApp/WeatherApp/Supporting Files/add_2x.png new file mode 100755 index 0000000..3191d52 Binary files /dev/null and b/WeatherApp/WeatherApp/Supporting Files/add_2x.png differ diff --git a/WeatherApp/WeatherApp/View/Main.storyboard b/WeatherApp/WeatherApp/View/Main.storyboard index 2c4ac34..6c190e5 100644 --- a/WeatherApp/WeatherApp/View/Main.storyboard +++ b/WeatherApp/WeatherApp/View/Main.storyboard @@ -1,11 +1,11 @@ - - + + - + @@ -23,7 +23,7 @@ - + @@ -136,11 +136,11 @@ - +