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
073eda93
Commit
073eda93
authored
Mar 12, 2021
by
Demid Merzlyakov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed ForecastTimePeriod
parent
c897c67a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
35 deletions
+16
-35
1Weather.xcodeproj/project.pbxproj
+0
-4
1Weather/Model/ModelObjects/ForecastTimePeriod.swift
+0
-13
1Weather/UI/Helpers/ForecastTimePeriodView.swift
+15
-16
1Weather/UI/View controllers/Today/Cells/CityForecastTimePeriod/CityForecastTimePeriodCell.swift
+1
-2
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
073eda93
...
...
@@ -28,7 +28,6 @@
CD6B303E25726960004B34B3
/* ThemeProtocol.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD6B303D25726960004B34B3
/* ThemeProtocol.swift */
;
};
CD6B304325726AD1004B34B3
/* DefaultTheme.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD6B304225726AD1004B34B3
/* DefaultTheme.swift */
;
};
CD71709025FA317700A63C27
/* ForecastTimePeriodView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD71708F25FA317700A63C27
/* ForecastTimePeriodView.swift */
;
};
CD71709325FA31C200A63C27
/* ForecastTimePeriod.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD71709225FA31C200A63C27
/* ForecastTimePeriod.swift */
;
};
CD80917B2578E4A8003541A4
/* UIViewController+Alert.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD80917A2578E4A8003541A4
/* UIViewController+Alert.swift */
;
};
CD822FF525D6817000A05501
/* CityForecastCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD822FF425D6817000A05501
/* CityForecastCell.swift */
;
};
CD822FFA25D6890900A05501
/* OneWeatherColorsAsset.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD822FF925D6890900A05501
/* OneWeatherColorsAsset.xcassets */
;
};
...
...
@@ -113,7 +112,6 @@
CD6B303D25726960004B34B3
/* ThemeProtocol.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ThemeProtocol.swift
;
sourceTree
=
"<group>"
;
};
CD6B304225726AD1004B34B3
/* DefaultTheme.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultTheme.swift
;
sourceTree
=
"<group>"
;
};
CD71708F25FA317700A63C27
/* ForecastTimePeriodView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastTimePeriodView.swift
;
sourceTree
=
"<group>"
;
};
CD71709225FA31C200A63C27
/* ForecastTimePeriod.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastTimePeriod.swift
;
sourceTree
=
"<group>"
;
};
CD80917A2578E4A8003541A4
/* UIViewController+Alert.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIViewController+Alert.swift"
;
sourceTree
=
"<group>"
;
};
CD822FF425D6817000A05501
/* CityForecastCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CityForecastCell.swift
;
sourceTree
=
"<group>"
;
};
CD822FF925D6890900A05501
/* OneWeatherColorsAsset.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
OneWeatherColorsAsset.xcassets
;
sourceTree
=
"<group>"
;
};
...
...
@@ -496,7 +494,6 @@
CEAFF08B25DFC6BC00DF4EBF
/* DailyWeather.swift */
,
CEAFF08E25DFC6ED00DF4EBF
/* HourlyWeather.swift */
,
CE578FD225F7E89400E8B85D
/* DayTimeWeather.swift */
,
CD71709225FA31C200A63C27
/* ForecastTimePeriod.swift */
,
);
path
=
ModelObjects
;
sourceTree
=
"<group>"
;
...
...
@@ -682,7 +679,6 @@
CDEE8AD725DA882200C289DE
/* PeriodForecastButton.swift in Sources */
,
CDE18DD125D166F900C80ED9
/* ForecastViewController.swift in Sources */
,
CD39F2F525DE9571009FE398
/* ArrowButton.swift in Sources */
,
CD71709325FA31C200A63C27
/* ForecastTimePeriod.swift in Sources */
,
CEDE4E8325EEFD56007457E9
/* WdtLocationResponse.swift in Sources */
,
CDC6125325E79C8F00188DA7
/* DayTimeView.swift in Sources */
,
CD86246925E672A20097F3FB
/* PrecipButton.swift in Sources */
,
...
...
1Weather/Model/ModelObjects/ForecastTimePeriod.swift
deleted
100644 → 0
View file @
c897c67a
//
// ForecastTimePeriod.swift
// 1Weather
//
// Created by Dmitry Stepanets on 11.03.2021.
//
import
UIKit
struct
ForecastTimePeriod
{
let
daily
:[
DailyWeather
]
let
hourly
:[
HourlyWeather
]
}
1Weather/UI/Helpers/ForecastTimePeriodView.swift
View file @
073eda93
...
...
@@ -30,11 +30,8 @@ class ForecastTimePeriodView: UIView {
private
var
currentTimePeriod
=
TimePeriod
.
daily
private
var
dailyGraphPoints
=
DailyGraphPoints
(
maxTempPoints
:
[
CGPoint
](),
minTempPoints
:
[
CGPoint
]())
private
var
hourlyGraphPoints
=
HourlyGraphPoints
(
points
:
[
CGPoint
]())
private
var
forecastTimePeriod
:
ForecastTimePeriod
=
ForecastTimePeriod
(
daily
:
[
DailyWeather
](),
hourly
:
[
HourlyWeather
]())
{
didSet
{
rebuildButtons
()
}
}
private
var
daily
=
[
DailyWeather
]()
private
var
hourly
=
[
HourlyWeather
]()
init
()
{
super
.
init
(
frame
:
.
zero
)
...
...
@@ -50,8 +47,10 @@ class ForecastTimePeriodView: UIView {
}
//Public
public
func
set
(
forecastTimePeriod
:
ForecastTimePeriod
)
{
self
.
forecastTimePeriod
=
forecastTimePeriod
public
func
set
(
location
:
Location
)
{
self
.
daily
=
location
.
daily
self
.
hourly
=
location
.
hourly
rebuildButtons
()
}
public
func
set
(
timePeriod
:
TimePeriod
)
{
...
...
@@ -68,18 +67,18 @@ class ForecastTimePeriodView: UIView {
switch
currentTimePeriod
{
case
.
daily
:
for
index
in
0
..<
forecastTimePeriod
.
daily
.
count
{
for
index
in
0
..<
daily
.
count
{
let
forecastButton
=
PeriodForecastButton
()
forecastButton
.
configure
(
dailyWeather
:
forecastTimePeriod
.
daily
[
index
])
forecastButton
.
configure
(
dailyWeather
:
daily
[
index
])
forecastButton
.
index
=
index
forecastButton
.
addTarget
(
self
,
action
:
#selector(
handleForecastButton(button:)
)
,
for
:
.
touchUpInside
)
forecastButton
.
isSelected
=
index
==
1
stackView
.
addArrangedSubview
(
forecastButton
)
}
case
.
hourly
:
for
index
in
0
..<
forecastTimePeriod
.
hourly
.
count
{
for
index
in
0
..<
hourly
.
count
{
let
forecastButton
=
PeriodForecastButton
()
forecastButton
.
configure
(
hourlyWeather
:
forecastTimePeriod
.
hourly
[
index
])
forecastButton
.
configure
(
hourlyWeather
:
hourly
[
index
])
forecastButton
.
index
=
index
forecastButton
.
addTarget
(
self
,
action
:
#selector(
handleForecastButton(button:)
)
,
for
:
.
touchUpInside
)
forecastButton
.
isSelected
=
index
==
1
...
...
@@ -112,10 +111,10 @@ class ForecastTimePeriodView: UIView {
}
private
func
updateDailyGraphPoints
()
{
let
daysCount
=
forecastTimePeriod
.
daily
.
count
let
maxTemps
=
(
forecastTimePeriod
.
daily
.
map
{
CGFloat
(
$0
.
maxTemp
?
.
localeValue
??
0
)
})
let
daysCount
=
daily
.
count
let
maxTemps
=
(
daily
.
map
{
CGFloat
(
$0
.
maxTemp
?
.
localeValue
??
0
)
})
let
topMaxTemp
=
maxTemps
.
max
()
??
0
let
minTemps
=
(
forecastTimePeriod
.
daily
.
map
{
CGFloat
(
$0
.
minTemp
?
.
localeValue
??
0
)
})
let
minTemps
=
(
daily
.
map
{
CGFloat
(
$0
.
minTemp
?
.
localeValue
??
0
)
})
let
topMinTemp
=
minTemps
.
max
()
??
0
var
maxPoints
=
[
CGPoint
]()
...
...
@@ -150,8 +149,8 @@ class ForecastTimePeriodView: UIView {
}
private
func
updateHourlyGraphPoints
()
{
let
hoursCount
=
forecastTimePeriod
.
hourly
.
count
let
temps
=
(
forecastTimePeriod
.
hourly
.
map
{
CGFloat
(
$0
.
temp
?
.
localeValue
??
0
)
})
let
hoursCount
=
hourly
.
count
let
temps
=
(
hourly
.
map
{
CGFloat
(
$0
.
temp
?
.
localeValue
??
0
)
})
let
maxTemp
=
temps
.
max
()
??
0
...
...
1Weather/UI/View controllers/Today/Cells/CityForecastTimePeriod/CityForecastTimePeriodCell.swift
View file @
073eda93
...
...
@@ -32,8 +32,7 @@ class CityForecastTimePeriodCell: UITableViewCell {
//Public
public
func
configure
(
with
location
:
Location
)
{
let
forecastTimePeriod
=
ForecastTimePeriod
(
daily
:
location
.
daily
,
hourly
:
location
.
hourly
)
self
.
forecastTimePeriodView
.
set
(
forecastTimePeriod
:
forecastTimePeriod
)
self
.
forecastTimePeriodView
.
set
(
location
:
location
)
}
@objc
private
func
handleSegmentDidChange
()
{
...
...
Dmitriy Stepanets
@DStepanets
mentioned in commit
61330bf8
Mar 15, 2021
mentioned in commit
61330bf8
mentioned in commit 61330bf8cd7cde2558b59bad8dbeace7adb18ba8
Toggle commit list
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