Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
f14dbb96
Commit
f14dbb96
authored
Apr 23, 2021
by
Dmitriy Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on time zones
parent
2128cb7f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
158 additions
and
100 deletions
+158
-100
1Weather.xcodeproj/project.pbxproj
+8
-0
1Weather.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
+1
-1
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+5
-53
1Weather/Extensions/Date+TimeZoneConvert.swift
+15
-0
1Weather/UI/View controllers/Radar/MapTimeControl/MapTimeControlItem.swift
+13
-0
1Weather/UI/View controllers/Radar/MapTimeControl/MapTimeControlView.swift
+10
-5
1Weather/UI/View controllers/Radar/MapTimeControl/MapTimeView.swift
+18
-9
1Weather/UI/View controllers/Radar/RadarViewController.swift
+18
-5
1Weather/ViewModels/RadarViewModel.swift
+39
-0
Pods/Pods.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
+25
-25
Pods/Swarm/Swarm/SwarmOverlay.swift
+4
-2
Pods/Swarm/Swarm/SwarmTileOverlayRenderer.swift
+2
-0
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
f14dbb96
...
...
@@ -115,6 +115,7 @@
CDA5542825EF734200A2E08C
/* TodayCellFactory.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542725EF734200A2E08C
/* TodayCellFactory.swift */
;
};
CDA5542D25EF7C9700A2E08C
/* ReusableCellProtocol.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542C25EF7C9700A2E08C
/* ReusableCellProtocol.swift */
;
};
CDA5543025EFA13F00A2E08C
/* Measurement+String.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542F25EFA13F00A2E08C
/* Measurement+String.swift */
;
};
CDAC9B8526319B0500AC1BF4
/* MapTimeControlItem.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
;
};
CDAD97B1262042B2007FCFB1
/* MapButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD97B0262042B2007FCFB1
/* MapButton.swift */
;
};
CDAD97B426207D14007FCFB1
/* MapTimeControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
;
};
CDC6124F25E7964700188DA7
/* TodayDayTimesCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDC6124E25E7964700188DA7
/* TodayDayTimesCell.swift */
;
};
...
...
@@ -127,6 +128,7 @@
CDD0F1E52572425200CF5017
/* SF-Pro.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD0F1E42572425200CF5017
/* SF-Pro.ttf */
;
};
CDD0F1E82572429E00CF5017
/* AppFont.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD0F1E72572429E00CF5017
/* AppFont.swift */
;
};
CDD0F1EE25725BCF00CF5017
/* ThemeManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD0F1ED25725BCF00CF5017
/* ThemeManager.swift */
;
};
CDD17E2E263300CF00E92B6A
/* Date+TimeZoneConvert.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD17E2D263300CF00E92B6A
/* Date+TimeZoneConvert.swift */
;
};
CDD75F0D25DE68B10099ACDB
/* Localizable.strings in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD75F0F25DE68B10099ACDB
/* Localizable.strings */
;
};
CDDE8D7C262EED3C00267931
/* MapLegendSevereView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDDE8D7B262EED3C00267931
/* MapLegendSevereView.swift */
;
};
CDDE8D7F262EED4D00267931
/* MapLegendWeatherView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDDE8D7E262EED4D00267931
/* MapLegendWeatherView.swift */
;
};
...
...
@@ -322,6 +324,7 @@
CDA5542725EF734200A2E08C
/* TodayCellFactory.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TodayCellFactory.swift
;
sourceTree
=
"<group>"
;
};
CDA5542C25EF7C9700A2E08C
/* ReusableCellProtocol.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ReusableCellProtocol.swift
;
sourceTree
=
"<group>"
;
};
CDA5542F25EFA13F00A2E08C
/* Measurement+String.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Measurement+String.swift"
;
sourceTree
=
"<group>"
;
};
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapTimeControlItem.swift
;
sourceTree
=
"<group>"
;
};
CDAD97B0262042B2007FCFB1
/* MapButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapButton.swift
;
sourceTree
=
"<group>"
;
};
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapTimeControlView.swift
;
sourceTree
=
"<group>"
;
};
CDC6124E25E7964700188DA7
/* TodayDayTimesCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TodayDayTimesCell.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -334,6 +337,7 @@
CDD0F1E42572425200CF5017
/* SF-Pro.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"SF-Pro.ttf"
;
sourceTree
=
"<group>"
;
};
CDD0F1E72572429E00CF5017
/* AppFont.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppFont.swift
;
sourceTree
=
"<group>"
;
};
CDD0F1ED25725BCF00CF5017
/* ThemeManager.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ThemeManager.swift
;
sourceTree
=
"<group>"
;
};
CDD17E2D263300CF00E92B6A
/* Date+TimeZoneConvert.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Date+TimeZoneConvert.swift"
;
sourceTree
=
"<group>"
;
};
CDD75F0E25DE68B10099ACDB
/* en */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.strings
;
name
=
en
;
path
=
en.lproj/Localizable.strings
;
sourceTree
=
"<group>"
;
};
CDDE8D7B262EED3C00267931
/* MapLegendSevereView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapLegendSevereView.swift
;
sourceTree
=
"<group>"
;
};
CDDE8D7E262EED4D00267931
/* MapLegendWeatherView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapLegendWeatherView.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -532,6 +536,7 @@
CDF4808E261727E00076E9F5
/* CLAuthorizationStatus+Localized.swift */
,
CDF48091261729680076E9F5
/* UIApplication+Settings.swift */
,
CD67616C262587D30079D273
/* UITabBarController+Hide.swift */
,
CDD17E2D263300CF00E92B6A
/* Date+TimeZoneConvert.swift */
,
);
path
=
Extensions
;
sourceTree
=
"<group>"
;
...
...
@@ -810,6 +815,7 @@
isa
=
PBXGroup
;
children
=
(
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
,
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
,
CDF8F129262089A200DB384A
/* MapTimeView.swift */
,
CDF8F12C26208E7B00DB384A
/* MapCurrentTimeView.swift */
,
CD7F3ABC262443260041C478
/* MapPinnedLayersView.swift */
,
...
...
@@ -1418,6 +1424,7 @@
CD866A65260F642600E96A5C
/* SettingsDetailsViewController.swift in Sources */
,
CD647D0225ED07D60034578B
/* TodayViewModel.swift in Sources */
,
CD593BD32608BC3F00C93428
/* ForecastDayCell.swift in Sources */
,
CDAC9B8526319B0500AC1BF4
/* MapTimeControlItem.swift in Sources */
,
CD4742D0261200500061AC95
/* TodayAlertCell.swift in Sources */
,
CD15DB4225DA806C00024727
/* TodayForecastTimePeriodCell.swift in Sources */
,
CD7F3ABD262443260041C478
/* MapPinnedLayersView.swift in Sources */
,
...
...
@@ -1436,6 +1443,7 @@
CD55E0BB2615EE2400CC4DC7
/* PollutantView.swift in Sources */
,
CDDE8D7C262EED3C00267931
/* MapLegendSevereView.swift in Sources */
,
CD6761882625C3360079D273
/* RadarViewModel.swift in Sources */
,
CDD17E2E263300CF00E92B6A
/* Date+TimeZoneConvert.swift in Sources */
,
CDF8F12A262089A200DB384A
/* MapTimeView.swift in Sources */
,
CEC526FA25E7959A00DA58A5
/* WeatherSource.swift in Sources */
,
CDF4808F261727E00076E9F5
/* CLAuthorizationStatus+Localized.swift in Sources */
,
...
...
1Weather.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
f14dbb96
...
...
@@ -7,7 +7,7 @@
<
k
e
y
>
1Weather.xcscheme_
^#
shared
#^
_
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
6
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
5
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
PG
(
Playground
)
1.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
...
...
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
f14dbb96
...
...
@@ -7,64 +7,16 @@
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"
89C8A0DD-3D0D-4C33-BA19-94E6A7991DA2
"
uuid =
"
03921A78-9DF4-4BDE-88B6-E44035BF9063
"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"1Weather/
UI/Helpers/DayControlsNavigationBar
.swift"
filePath =
"1Weather/
Extensions/Calendar+TimeZone
.swift"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"50"
endingLineNumber =
"50"
landmarkName =
"restoreProgress()"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"14AFAEC9-A39D-4B7B-9B2D-C2DA2519300A"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"1Weather/UI/Helpers/DayControlsNavigationBar.swift"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"35"
endingLineNumber =
"35"
landmarkName =
"showControls(progressValue:)"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"D794B66E-D7A6-4A78-A1CE-C34AC9DC948E"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"1Weather/UI/Helpers/DayControlsNavigationBar.swift"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"51"
endingLineNumber =
"51"
landmarkName =
"restoreProgress()"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"2AD266BE-E133-463F-BF26-2797D4C1A0EF"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"1Weather/UI/Helpers/DayControlsNavigationBar.swift"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"40"
endingLineNumber =
"40"
landmarkName =
"showControls(progressValue:)"
startingLineNumber =
"21"
endingLineNumber =
"21"
landmarkName =
"isNow(fromDate:timeZone:)"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
...
...
1Weather/Extensions/Date+TimeZoneConvert.swift
0 → 100644
View file @
f14dbb96
//
// Date+TimeZoneConvert.swift
// 1Weather
//
// Created by Dmitry Stepanets on 23.04.2021.
//
import
Foundation
extension
Date
{
func
convert
(
from
initTimeZone
:
TimeZone
,
to
targetTimeZone
:
TimeZone
)
->
Date
{
let
delta
=
TimeInterval
(
targetTimeZone
.
secondsFromGMT
(
for
:
self
)
-
initTimeZone
.
secondsFromGMT
(
for
:
self
))
return
addingTimeInterval
(
delta
)
}
}
1Weather/UI/View controllers/Radar/MapTimeControl/MapTimeControlItem.swift
0 → 100644
View file @
f14dbb96
//
// MapTimeControlItem.swift
// 1Weather
//
// Created by Dmitry Stepanets on 22.04.2021.
//
import
Foundation
struct
MapTimeControlItem
{
let
value
:
String
let
date
:
Date
}
1Weather/UI/View controllers/Radar/MapTimeControl/MapTimeControlView.swift
View file @
f14dbb96
...
...
@@ -64,6 +64,16 @@ class MapTimeControlView: UIView {
updateUI
()
}
public
func
configure
(
items
:[
MapTimeControlItem
],
timeZone
:
TimeZone
)
{
stackView
.
removeAll
()
items
.
forEach
{
let
view
=
MapTimeView
(
item
:
$0
)
stackView
.
addArrangedSubview
(
view
)
}
stackView
.
layoutIfNeeded
()
}
private
func
updateUI
()
{
container
.
backgroundColor
=
ThemeManager
.
currentTheme
.
mapControlsColor
...
...
@@ -132,11 +142,6 @@ private extension MapTimeControlView {
make
.
left
.
equalTo
(
playButton
.
snp
.
right
)
.
offset
(
8
)
make
.
right
.
equalToSuperview
()
.
inset
(
8
)
}
for
_
in
0
..<
5
{
let
view
=
MapTimeView
()
stackView
.
addArrangedSubview
(
view
)
}
}
func
prepareCurrentTimeView
()
{
...
...
1Weather/UI/View controllers/Radar/MapTimeControl/MapTimeView.swift
View file @
f14dbb96
...
...
@@ -8,14 +8,22 @@
import
UIKit
class
MapTimeView
:
UIView
{
private
let
temp
Label
=
UILabel
()
private
let
value
Label
=
UILabel
()
private
let
timeLabel
=
UILabel
()
private
static
let
timeFormatter
:
DateFormatter
=
{
let
fmt
=
DateFormatter
()
fmt
.
dateFormat
=
"h:mm"
return
fmt
}()
init
()
{
init
(
item
:
MapTimeControlItem
)
{
super
.
init
(
frame
:
.
zero
)
prepareLabels
()
updateUI
()
valueLabel
.
text
=
item
.
value
timeLabel
.
text
=
MapTimeView
.
timeFormatter
.
string
(
from
:
item
.
date
)
}
required
init
?(
coder
:
NSCoder
)
{
...
...
@@ -30,20 +38,21 @@ class MapTimeView: UIView {
private
func
updateUI
()
{
switch
interfaceStyle
{
case
.
light
:
temp
Label
.
textColor
=
ThemeManager
.
currentTheme
.
secondaryTextColor
value
Label
.
textColor
=
ThemeManager
.
currentTheme
.
secondaryTextColor
timeLabel
.
textColor
=
ThemeManager
.
currentTheme
.
secondaryTextColor
case
.
dark
:
temp
Label
.
textColor
=
ThemeManager
.
currentTheme
.
primaryTextColor
value
Label
.
textColor
=
ThemeManager
.
currentTheme
.
primaryTextColor
timeLabel
.
textColor
=
ThemeManager
.
currentTheme
.
primaryTextColor
}
}
}
//MARK:- Prepare
private
extension
MapTimeView
{
func
prepareLabels
()
{
temp
Label
.
text
=
"45°"
temp
Label
.
font
=
AppFont
.
SFPro
.
regular
(
size
:
10
)
addSubview
(
temp
Label
)
value
Label
.
text
=
"45°"
value
Label
.
font
=
AppFont
.
SFPro
.
regular
(
size
:
10
)
addSubview
(
value
Label
)
timeLabel
.
text
=
"2:00"
timeLabel
.
textAlignment
=
.
center
...
...
@@ -52,14 +61,14 @@ private extension MapTimeView {
addSubview
(
timeLabel
)
//Constraints
temp
Label
.
snp
.
makeConstraints
{
(
make
)
in
value
Label
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
equalToSuperview
()
.
inset
(
10
)
make
.
centerX
.
equalToSuperview
()
}
timeLabel
.
snp
.
makeConstraints
{
(
make
)
in
make
.
bottom
.
equalToSuperview
()
.
inset
(
5
)
make
.
top
.
equalTo
(
temp
Label
.
snp
.
bottom
)
.
offset
(
4
)
make
.
top
.
equalTo
(
value
Label
.
snp
.
bottom
)
.
offset
(
4
)
make
.
left
.
right
.
equalToSuperview
()
.
inset
(
2
)
}
}
...
...
1Weather/UI/View controllers/Radar/RadarViewController.swift
View file @
f14dbb96
...
...
@@ -32,7 +32,7 @@ class RadarViewController: UIViewController {
if
let
overlay
=
swarmOverlay
{
overlay
.
startUpdating
(
block
:
{
[
weak
self
]
(
dataAvailable
,
updateError
)
in
self
?
.
swarmRenderer
?
.
setNeedsDisplay
()
//print("
Updating: \(String(describing: self?.updateDateLabel()))")
// print("[SWARM]
Updating: \(String(describing: self?.updateDateLabel()))")
})
mapView
.
addOverlay
(
overlay
,
level
:
.
aboveRoads
)
swarmRenderer
?
.
setNeedsDisplay
()
// forces overlay to update to latest radar view
...
...
@@ -80,7 +80,6 @@ class RadarViewController: UIViewController {
prepareMapTimeControl
()
updateUI
()
initialConfigure
()
setOverlay
()
}
//Private
...
...
@@ -97,6 +96,7 @@ class RadarViewController: UIViewController {
let
span
=
MKCoordinateSpan
(
latitudeDelta
:
3.0
,
longitudeDelta
:
3.0
)
let
coordinateRegion
=
MKCoordinateRegion
.
init
(
center
:
coordinates
,
span
:
span
)
mapView
.
setRegion
(
coordinateRegion
,
animated
:
true
)
setOverlay
()
}
private
func
initialConfigure
()
{
...
...
@@ -128,8 +128,21 @@ class RadarViewController: UIViewController {
overlay
.
alpha
=
0.85
// overlay.debug = true
overlay
.
queryTimes
{
(
_
,
error
)
in
overlay
.
queryTimes
{[
weak
self
]
(
_
,
error
)
in
guard
let
self
=
self
else
{
return
}
self
.
swarmOverlay
=
overlay
//Update timeline
if
let
validTimes
=
overlay
.
validTimes
as?
[
String
:
AnyObject
]
{
let
dates
=
validTimes
.
map
{
$0
.
value
}
.
first
as?
[
String
]
if
let
stringArray
=
dates
{
let
items
=
self
.
radarViewModel
.
buildTimelineValuesFor
(
validTimes
:
stringArray
)
if
let
timeZone
=
self
.
radarViewModel
.
location
?
.
timeZone
{
self
.
mapTimeControlView
.
configure
(
items
:
items
,
timeZone
:
timeZone
)
}
}
}
// _ = self.updateDateLabel()
}
}
...
...
@@ -151,9 +164,9 @@ class RadarViewController: UIViewController {
DispatchQueue
.
global
(
qos
:
.
userInitiated
)
.
async
{
/*self.progress*/
_
=
overlay
.
fetchTilesForAnimation
(
self
.
mapView
.
visibleMapRect
,
readyBlock
:
{
[
weak
self
]
in
guard
let
strongSelf
=
self
else
{
return
}
strongSelf
.
swarmOverlay
?
.
startAnimating
({
[
weak
self
]
(
_
)
in
strongSelf
.
swarmOverlay
?
.
startAnimating
({(
_
)
in
// let _ = self?.updateDateLabel() ?? ""
//
print("Animation: \(time)")
//
print("Animation: \(time)")
self
?
.
swarmRenderer
?
.
setNeedsDisplay
()
//setNeedsDisplayInMapRect((self?.mapView.visibleMapRect)!)
})
})
...
...
1Weather/ViewModels/RadarViewModel.swift
View file @
f14dbb96
...
...
@@ -6,6 +6,7 @@
//
import
UIKit
import
Swarm
protocol
RadarViewModelDelegate
:
ViewModelDelegate
{
func
viewModel
(
model
:
RadarViewModel
,
didSelectLayer
layer
:
RadarLayer
)
...
...
@@ -35,6 +36,14 @@ class RadarViewModel: ViewModelProtocol {
}
//Private
private
var
swarmDateFormatter
:
DateFormatter
=
{
let
fmt
=
DateFormatter
()
fmt
.
timeZone
=
TimeZone
(
secondsFromGMT
:
0
)
fmt
.
locale
=
Locale
(
identifier
:
"en_US_POSIX"
)
fmt
.
dateFormat
=
"yyyy-MM-dd'T'HH:mm:ss"
return
fmt
}()
private
let
locationManager
=
LocationManager
.
shared
var
location
:
Location
?
{
return
locationManager
.
selectedLocation
...
...
@@ -81,6 +90,36 @@ class RadarViewModel: ViewModelProtocol {
delegate
?
.
viewModel
(
model
:
self
,
didSelectLayer
:
selectedLayer
)
}
public
func
buildTimelineValuesFor
(
validTimes
:[
String
])
->
[
MapTimeControlItem
]
{
#warning("Comparing hourly & valid date disabled")
// guard let hourly = self.location?.hourly else {
// return []
// }
guard
let
locationTimeZone
=
location
?
.
timeZone
else
{
return
[]
}
var
items
=
[
MapTimeControlItem
]()
for
validTime
in
validTimes
{
guard
let
validDate
=
swarmDateFormatter
.
date
(
from
:
validTime
)
else
{
continue
}
let
timeZoneDate
=
validDate
.
convert
(
from
:
locationTimeZone
,
to
:
TimeZone
(
secondsFromGMT
:
0
)
!
)
items
.
append
(
.
init
(
value
:
""
,
date
:
timeZoneDate
))
// for hourlyWeather in hourly {
// if validDate == hourlyWeather.date {
// items.append(.init(value: hourlyWeather.temp?.shortString ?? "",
// date: validDate))
// }
// }
}
return
items
}
//Private
private
func
rebuildLayers
()
{
let
pinnedLayerIds
=
Settings
.
shared
.
pinnedLayerIds
...
...
Pods/Pods.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
f14dbb96
...
...
@@ -9,175 +9,175 @@
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
0
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
BezierKit.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Cirque.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
3
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Firebase.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
4
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
3
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseABTesting.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
5
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
4
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseAnalytics.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
6
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
5
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseCore.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
7
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
6
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseCoreDiagnostics.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
8
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
7
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseCrashlytics.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
9
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
8
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseInstallations.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
10
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
9
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
FirebaseRemoteConfig.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
1
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
0
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Flurry-iOS-SDK.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
2
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
1
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
GoogleAppMeasurement.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
3
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
2
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
GoogleDataTransport.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
4
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
3
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
GoogleUtilities.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
5
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
4
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Localize-Swift.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
6
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
5
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Logging.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
7
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
6
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
MORichNotification.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
9
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
8
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
MoEngage-iOS-SDK.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
1
8
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
1
7
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Pods-1Weather.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
1
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
0
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
PromisesObjC.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
2
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
1
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
SnapKit.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
3
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
2
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
Swarm.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
4
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
3
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
XMLCoder.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
2
5
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
2
4
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
nanopb.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
20
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
19
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
k
e
y
>
SuppressBuildableAutocreation
<
/k
e
y
>
...
...
Pods/Swarm/Swarm/SwarmOverlay.swift
View file @
f14dbb96
...
...
@@ -39,7 +39,9 @@ import MapKit
open
var
loopZoomOffset
=
0
{
didSet
{
if
loopZoomOffset
<
0
{
loopZoomOffset
=
0
}
}
}
internal
var
currentFrameTimestamp
:
String
{
return
(
index
>=
0
&&
index
<
loopTimes
.
count
)
?
loopTimes
[
index
]
:
""
}
internal
var
currentFrameTimestamp
:
String
{
return
(
index
>=
0
&&
index
<
loopTimes
.
count
)
?
loopTimes
[
index
]
:
""
}
fileprivate
var
timestamp
:
String
?
=
nil
...
...
@@ -67,7 +69,7 @@ import MapKit
fileprivate
let
renderedImageCache
=
NSCache
<
AnyObject
,
AnyObject
>
()
fileprivate
var
validTimes
:
AnyObject
?
=
nil
public
private(set)
var
validTimes
:
AnyObject
?
=
nil
fileprivate
var
loopTimes
:
[
String
]
=
[]
{
didSet
{
index
=
loopTimes
.
count
-
1
}
}
internal(set)
var
zoomScale
:
MKZoomScale
=
0.0
...
...
Pods/Swarm/Swarm/SwarmTileOverlayRenderer.swift
View file @
f14dbb96
...
...
@@ -35,6 +35,8 @@ open class SwarmTileOverlayRenderer: MKTileOverlayRenderer {
return
true
}
print
(
"[SWARM] TimeStamp:
\(
timeStamp
)
"
)
swarmOverlay
.
downloadTileAtURL
(
url
)
{
[
weak
self
]
error
in
guard
error
==
nil
else
{
return
}
self
?
.
setNeedsDisplay
(
mapRect
,
zoomScale
:
zoomScale
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment