From 76844e33e3df5ca4431bc81d50ae2db4091ec295 Mon Sep 17 00:00:00 2001 From: MhdHejazi Date: Wed, 25 Mar 2020 14:06:01 +0300 Subject: [PATCH] Unify names and terms. --- Corona.xcodeproj/project.pbxproj | 20 +++++++------- ...ChartView.swift => CurrentChartView.swift} | 4 +-- ...riesChartView.swift => TopChartView.swift} | 6 ++--- Corona/Controller/MapController.swift | 4 +-- Corona/Controller/RegionDataCell.swift | 20 +++++++------- Corona/Controller/RegionDataController.swift | 10 +++---- Corona/Controller/RegionListController.swift | 26 +++++++++---------- Corona/Main.storyboard | 12 ++++----- Corona/Map/RegionAnnotationView.swift | 2 +- Corona/Menu/MenuController.swift | 6 ++--- Corona/Util/Extensions.swift | 2 +- 11 files changed, 56 insertions(+), 56 deletions(-) rename Corona/Chart/{CurrentStateChartView.swift => CurrentChartView.swift} (96%) rename Corona/Chart/{TopCountriesChartView.swift => TopChartView.swift} (96%) diff --git a/Corona.xcodeproj/project.pbxproj b/Corona.xcodeproj/project.pbxproj index c60b78b..ed5a4ed 100644 --- a/Corona.xcodeproj/project.pbxproj +++ b/Corona.xcodeproj/project.pbxproj @@ -69,9 +69,9 @@ 1186BC72242B64FE00097E9E /* RegionDataCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1186BC71242B64FE00097E9E /* RegionDataCell.swift */; }; 1195F1A5241EC1FB00FE718F /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = 1195F1A4241EC1FB00FE718F /* Charts */; }; 11BF32AA24156AE500270130 /* FloatingPanel in Frameworks */ = {isa = PBXBuildFile; productRef = 11BF32A924156AE500270130 /* FloatingPanel */; }; - 11EB2C9D2413F7E9001769B2 /* CurrentStateChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11EB2C9C2413F7E9001769B2 /* CurrentStateChartView.swift */; }; + 11EB2C9D2413F7E9001769B2 /* CurrentChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11EB2C9C2413F7E9001769B2 /* CurrentChartView.swift */; }; 11EB2C9F2413FFE1001769B2 /* HistoryChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11EB2C9E2413FFE1001769B2 /* HistoryChartView.swift */; }; - 11EB2CA1241400EF001769B2 /* TopCountriesChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11EB2CA0241400EF001769B2 /* TopCountriesChartView.swift */; }; + 11EB2CA1241400EF001769B2 /* TopChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11EB2CA0241400EF001769B2 /* TopChartView.swift */; }; 3447B4BB241E7631003914AF /* RegionListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1195F19D241D2E7900FE718F /* RegionListController.swift */; }; 3447B4BD241E7790003914AF /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3447B4BC241E7790003914AF /* App.swift */; }; 344ED322241AC7AA004C4EA8 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344ED321241AC7AA004C4EA8 /* NotificationCenter.framework */; }; @@ -152,9 +152,9 @@ 1186BC71242B64FE00097E9E /* RegionDataCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegionDataCell.swift; sourceTree = ""; }; 1195F19D241D2E7900FE718F /* RegionListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegionListController.swift; sourceTree = ""; }; 11BF32B024166E5C00270130 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = ""; }; - 11EB2C9C2413F7E9001769B2 /* CurrentStateChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentStateChartView.swift; sourceTree = ""; }; + 11EB2C9C2413F7E9001769B2 /* CurrentChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentChartView.swift; sourceTree = ""; }; 11EB2C9E2413FFE1001769B2 /* HistoryChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryChartView.swift; sourceTree = ""; }; - 11EB2CA0241400EF001769B2 /* TopCountriesChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopCountriesChartView.swift; sourceTree = ""; }; + 11EB2CA0241400EF001769B2 /* TopChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopChartView.swift; sourceTree = ""; }; 18CAD032242A5E1200CA1CEE /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; 3447B4BC241E7790003914AF /* App.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = ""; }; 344ED31F241AC7AA004C4EA8 /* Widget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Widget.appex; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -218,12 +218,12 @@ 1151868F241FAECB00EBC83E /* Model */ = { isa = PBXGroup; children = ( + 11518694241FAECB00EBC83E /* Region.swift */, 11518690241FAECB00EBC83E /* Report.swift */, 11518691241FAECB00EBC83E /* TimeSeries.swift */, 11518692241FAECB00EBC83E /* Coordinate.swift */, 11518693241FAECB00EBC83E /* Statistic.swift */, 115186BE242019EE00EBC83E /* Change.swift */, - 11518694241FAECB00EBC83E /* Region.swift */, ); path = Model; sourceTree = ""; @@ -283,10 +283,10 @@ 1162D151240F934000647002 /* Chart */ = { isa = PBXGroup; children = ( - 11EB2C9C2413F7E9001769B2 /* CurrentStateChartView.swift */, - 11EB2C9E2413FFE1001769B2 /* HistoryChartView.swift */, - 11EB2CA0241400EF001769B2 /* TopCountriesChartView.swift */, + 11EB2C9C2413F7E9001769B2 /* CurrentChartView.swift */, 1186BC5C24291D4000097E9E /* DeltaChartView.swift */, + 11EB2C9E2413FFE1001769B2 /* HistoryChartView.swift */, + 11EB2CA0241400EF001769B2 /* TopChartView.swift */, 1162D153240F934000647002 /* BalloonMarker.swift */, 1162D152240F934000647002 /* SimpleMarkerView.swift */, 11672A1B24114922000B2466 /* PercentValueFormatter.swift */, @@ -528,7 +528,7 @@ 1114CFC82423F8CC00B1CF85 /* ImageItemSource.swift in Sources */, 1151869C241FAF6200EBC83E /* Extensions.swift in Sources */, 1114CFC92423F8CC00B1CF85 /* TextItemSource.swift in Sources */, - 11EB2CA1241400EF001769B2 /* TopCountriesChartView.swift in Sources */, + 11EB2CA1241400EF001769B2 /* TopChartView.swift in Sources */, 3447B4BD241E7790003914AF /* App.swift in Sources */, 115186C024203D5100EBC83E /* Change.swift in Sources */, 1186BC6E242B608200097E9E /* RegionDataController.swift in Sources */, @@ -545,7 +545,7 @@ 1186BC5D24291D4000097E9E /* DeltaChartView.swift in Sources */, 1162D12E240D05F600647002 /* SceneDelegate.swift in Sources */, 1162D156240F934100647002 /* BalloonMarker.swift in Sources */, - 11EB2C9D2413F7E9001769B2 /* CurrentStateChartView.swift in Sources */, + 11EB2C9D2413F7E9001769B2 /* CurrentChartView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Corona/Chart/CurrentStateChartView.swift b/Corona/Chart/CurrentChartView.swift similarity index 96% rename from Corona/Chart/CurrentStateChartView.swift rename to Corona/Chart/CurrentChartView.swift index bcca088..9ccd8ad 100644 --- a/Corona/Chart/CurrentStateChartView.swift +++ b/Corona/Chart/CurrentChartView.swift @@ -1,5 +1,5 @@ // -// CurrentStateChart.swift +// CurrentChartView.swift // Corona Tracker // // Created by Mohammad on 3/7/20. @@ -10,7 +10,7 @@ import UIKit import Charts -class CurrentStateChartView: PieChartView { +class CurrentChartView: PieChartView { required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) diff --git a/Corona/Chart/TopCountriesChartView.swift b/Corona/Chart/TopChartView.swift similarity index 96% rename from Corona/Chart/TopCountriesChartView.swift rename to Corona/Chart/TopChartView.swift index 049112d..346f569 100644 --- a/Corona/Chart/TopCountriesChartView.swift +++ b/Corona/Chart/TopChartView.swift @@ -1,5 +1,5 @@ // -// CurrentStateChart.swift +// TopChartView.swift // Corona Tracker // // Created by Mohammad on 3/7/20. @@ -10,7 +10,7 @@ import UIKit import Charts -class TopCountriesChartView: BarChartView { +class TopChartView: BarChartView { var isLogarithmic = false { didSet { self.clear() @@ -116,7 +116,7 @@ class TopCountriesChartView: BarChartView { data = BarChartData(dataSet: dataSet) if animated { - animate(yAxisDuration: 2) + animate(yAxisDuration: 2, easingOption: .easeOutCubic) } } } diff --git a/Corona/Controller/MapController.swift b/Corona/Controller/MapController.swift index efbc8ee..2c51ea2 100644 --- a/Corona/Controller/MapController.swift +++ b/Corona/Controller/MapController.swift @@ -309,8 +309,8 @@ extension MapController: FloatingPanelControllerDelegate { if currentPosition == .full, regionPanelController.isSearching { // Reset to region container's default mode then hide the keyboard self.regionPanelController.isSearching = false - } - } + } + } } class PanelLayout: FloatingPanelLayout { diff --git a/Corona/Controller/RegionDataCell.swift b/Corona/Controller/RegionDataCell.swift index bd7e41b..4abd22e 100644 --- a/Corona/Controller/RegionDataCell.swift +++ b/Corona/Controller/RegionDataCell.swift @@ -194,47 +194,47 @@ class StatsCell: RegionDataCell { } class CurrentChartCell: RegionDataCell { - @IBOutlet var chartViewCurrent: CurrentStateChartView! + @IBOutlet var chartView: CurrentChartView! override var shareable: Shareable? { .chartCurrent } override func update(animated: Bool) { - chartViewCurrent.update(report: region?.report, animated: animated) + chartView.update(report: region?.report, animated: animated) } } class DeltaChartCell: RegionDataCell { - @IBOutlet var chartViewDelta: DeltaChartView! + @IBOutlet var chartView: DeltaChartView! override var shareable: Shareable? { .chartDelta } override func update(animated: Bool) { - chartViewDelta.update(series: region?.timeSeries, animated: animated) + chartView.update(series: region?.timeSeries, animated: animated) } } class HistoryChartCell: RegionDataCell { - @IBOutlet var chartViewHistory: HistoryChartView! + @IBOutlet var chartView: HistoryChartView! override var shareable: Shareable? { .chartHistory } override func update(animated: Bool) { - chartViewHistory.update(series: region?.timeSeries, animated: animated) + chartView.update(series: region?.timeSeries, animated: animated) } } class TopChartCell: RegionDataCell { - @IBOutlet var chartViewTopCountries: TopCountriesChartView! + @IBOutlet var chartView: TopChartView! override var shareable: Shareable? { .chartTop } override func update(animated: Bool) { - chartViewTopCountries.update(animated: animated) + chartView.update(animated: animated) } @IBAction func buttonLogarithmicTapped(_ sender: Any) { - UIView.transition(with: chartViewTopCountries, duration: 0.25, options: [.transitionCrossDissolve], animations: { - self.chartViewTopCountries.isLogarithmic = !self.chartViewTopCountries.isLogarithmic + UIView.transition(with: chartView, duration: 0.25, options: [.transitionCrossDissolve], animations: { + self.chartView.isLogarithmic = !self.chartView.isLogarithmic }, completion: nil) } } diff --git a/Corona/Controller/RegionDataController.swift b/Corona/Controller/RegionDataController.swift index cde81f8..d5d4381 100644 --- a/Corona/Controller/RegionDataController.swift +++ b/Corona/Controller/RegionDataController.swift @@ -9,8 +9,8 @@ import UIKit class RegionDataController: UITableViewController { - private typealias Cell = (type: RegionDataCell.Type, height: CGFloat) - private let cells: [Cell] = [ + private typealias Row = (type: RegionDataCell.Type, height: CGFloat) + private let rows: [Row] = [ (type: StatsCell.self, height: 150), (type: CurrentChartCell.self, height: 250), (type: DeltaChartCell.self, height: 250), @@ -95,11 +95,11 @@ class RegionDataController: UITableViewController { extension RegionDataController { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - cells.count + rows.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cellType = cells[indexPath.row].type + let cellType = rows[indexPath.row].type let cell = tableView.dequeueReusableCell(withIdentifier: cellType.reuseIdentifier, for: indexPath) if let cell = cell as? RegionDataCell { cell.region = region @@ -112,7 +112,7 @@ extension RegionDataController { } override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - cells[indexPath.row].height + rows[indexPath.row].height } override func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool { diff --git a/Corona/Controller/RegionListController.swift b/Corona/Controller/RegionListController.swift index d682437..0035496 100644 --- a/Corona/Controller/RegionListController.swift +++ b/Corona/Controller/RegionListController.swift @@ -15,36 +15,36 @@ class RegionListController: UITableViewController { } } - override func viewDidLoad() { - super.viewDidLoad() + override func viewDidLoad() { + super.viewDidLoad() tableView.rowHeight = 55 - } + } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) } - // MARK: - Table view data source + // MARK: - Table view data source - override func numberOfSections(in tableView: UITableView) -> Int { - return 1 - } + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return regions.count - } + } - override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let identifier = String(describing: RegionCell.self) - let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! RegionCell + let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! RegionCell let region = regions[indexPath.row] cell.region = region - return cell - } + return cell + } } class RegionCell: UITableViewCell { diff --git a/Corona/Main.storyboard b/Corona/Main.storyboard index 8136d8f..9ed1df6 100644 --- a/Corona/Main.storyboard +++ b/Corona/Main.storyboard @@ -237,7 +237,7 @@ - + @@ -251,7 +251,7 @@ - + @@ -275,7 +275,7 @@ - + @@ -299,7 +299,7 @@ - + @@ -309,7 +309,7 @@ - + @@ -336,7 +336,7 @@ - + diff --git a/Corona/Map/RegionAnnotationView.swift b/Corona/Map/RegionAnnotationView.swift index 031f09f..0c74584 100644 --- a/Corona/Map/RegionAnnotationView.swift +++ b/Corona/Map/RegionAnnotationView.swift @@ -90,7 +90,7 @@ class RegionAnnotationView: MKAnnotationView { } configure() - + /// Ensure that the report text is set each time the annotation is updated detailAccessoryView?.detailsLabel?.attributedText = detailsString } diff --git a/Corona/Menu/MenuController.swift b/Corona/Menu/MenuController.swift index 6e0ceea..ff7d06f 100644 --- a/Corona/Menu/MenuController.swift +++ b/Corona/Menu/MenuController.swift @@ -23,8 +23,8 @@ class MenuController: UITableViewController { fatalError("init(coder:) has not been implemented") } - override func viewDidLoad() { - super.viewDidLoad() + override func viewDidLoad() { + super.viewDidLoad() tableView.isScrollEnabled = false tableView.showsVerticalScrollIndicator = false @@ -36,7 +36,7 @@ class MenuController: UITableViewController { tableView.separatorEffect = UIBlurEffect() preferredContentSize = CGSize(width: width, height: tableView.rowHeight * CGFloat(items.count) - 1) - } + } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { items.count diff --git a/Corona/Util/Extensions.swift b/Corona/Util/Extensions.swift index 5bddeaa..01b16ae 100644 --- a/Corona/Util/Extensions.swift +++ b/Corona/Util/Extensions.swift @@ -111,7 +111,7 @@ extension TimeZone { extension Double { public var kmFormatted: String { - if self >= 10_000, self < 1_000_000 { + if self >= 1_000, self < 1_000_000 { return String(format: "%.1fk", locale: .posix, self / 1_000).replacingOccurrences(of: ".0", with: "") }