Skip to content

Commit

Permalink
Unify names and terms.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhdhejazi committed Mar 25, 2020
1 parent 028da73 commit 76844e3
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 56 deletions.
20 changes: 10 additions & 10 deletions Corona.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -152,9 +152,9 @@
1186BC71242B64FE00097E9E /* RegionDataCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegionDataCell.swift; sourceTree = "<group>"; };
1195F19D241D2E7900FE718F /* RegionListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegionListController.swift; sourceTree = "<group>"; };
11BF32B024166E5C00270130 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
11EB2C9C2413F7E9001769B2 /* CurrentStateChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentStateChartView.swift; sourceTree = "<group>"; };
11EB2C9C2413F7E9001769B2 /* CurrentChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentChartView.swift; sourceTree = "<group>"; };
11EB2C9E2413FFE1001769B2 /* HistoryChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryChartView.swift; sourceTree = "<group>"; };
11EB2CA0241400EF001769B2 /* TopCountriesChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopCountriesChartView.swift; sourceTree = "<group>"; };
11EB2CA0241400EF001769B2 /* TopChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopChartView.swift; sourceTree = "<group>"; };
18CAD032242A5E1200CA1CEE /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
3447B4BC241E7790003914AF /* App.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
344ED31F241AC7AA004C4EA8 /* Widget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Widget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -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 = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand All @@ -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;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// CurrentStateChart.swift
// CurrentChartView.swift
// Corona Tracker
//
// Created by Mohammad on 3/7/20.
Expand All @@ -10,7 +10,7 @@ import UIKit

import Charts

class CurrentStateChartView: PieChartView {
class CurrentChartView: PieChartView {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// CurrentStateChart.swift
// TopChartView.swift
// Corona Tracker
//
// Created by Mohammad on 3/7/20.
Expand All @@ -10,7 +10,7 @@ import UIKit

import Charts

class TopCountriesChartView: BarChartView {
class TopChartView: BarChartView {
var isLogarithmic = false {
didSet {
self.clear()
Expand Down Expand Up @@ -116,7 +116,7 @@ class TopCountriesChartView: BarChartView {
data = BarChartData(dataSet: dataSet)

if animated {
animate(yAxisDuration: 2)
animate(yAxisDuration: 2, easingOption: .easeOutCubic)
}
}
}
4 changes: 2 additions & 2 deletions Corona/Controller/MapController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 10 additions & 10 deletions Corona/Controller/RegionDataCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
10 changes: 5 additions & 5 deletions Corona/Controller/RegionDataController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
26 changes: 13 additions & 13 deletions Corona/Controller/RegionListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions Corona/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="250"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VZx-82-PuJ" customClass="CurrentStateChartView" customModule="Corona_Tracker" customModuleProvider="target">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VZx-82-PuJ" customClass="CurrentChartView" customModule="Corona_Tracker" customModuleProvider="target">
<rect key="frame" x="20" y="20" width="374" height="210"/>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
Expand All @@ -251,7 +251,7 @@
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="chartViewCurrent" destination="VZx-82-PuJ" id="lyz-zi-qnE"/>
<outlet property="chartView" destination="VZx-82-PuJ" id="lyz-zi-qnE"/>
</connections>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="DeltaChartCell" rowHeight="250" id="bNI-r6-c0N" customClass="DeltaChartCell" customModule="Corona_Tracker" customModuleProvider="target">
Expand All @@ -275,7 +275,7 @@
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="chartViewDelta" destination="mlc-W0-j2h" id="i7W-hh-Sj0"/>
<outlet property="chartView" destination="mlc-W0-j2h" id="i7W-hh-Sj0"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="HistoryChartCell" rowHeight="300" id="0ul-CC-Weu" customClass="HistoryChartCell" customModule="Corona_Tracker" customModuleProvider="target">
Expand All @@ -299,7 +299,7 @@
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="chartViewHistory" destination="a8U-m1-EOW" id="8OU-o8-iou"/>
<outlet property="chartView" destination="a8U-m1-EOW" id="8OU-o8-iou"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TopChartCell" rowHeight="350" id="M89-3e-QJ7" customClass="TopChartCell" customModule="Corona_Tracker" customModuleProvider="target">
Expand All @@ -309,7 +309,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="350"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="71d-xP-f0E" customClass="TopCountriesChartView" customModule="Corona_Tracker" customModuleProvider="target">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="71d-xP-f0E" customClass="TopChartView" customModule="Corona_Tracker" customModuleProvider="target">
<rect key="frame" x="20" y="20" width="374" height="310"/>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
Expand All @@ -336,7 +336,7 @@
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="chartViewTopCountries" destination="71d-xP-f0E" id="jJZ-iU-OsM"/>
<outlet property="chartView" destination="71d-xP-f0E" id="jJZ-iU-OsM"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="UpdateTimeCell" rowHeight="40" id="ce0-b4-Yib" customClass="UpdateTimeCell" customModule="Corona_Tracker" customModuleProvider="target">
Expand Down
2 changes: 1 addition & 1 deletion Corona/Map/RegionAnnotationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions Corona/Menu/MenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Corona/Util/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "")
}

Expand Down

0 comments on commit 76844e3

Please sign in to comment.