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
cfb301df
Commit
cfb301df
authored
Sep 29, 2021
by
Dmitry Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IOS-172]: Added minutely info view updating on scroll
parent
5fbd9a09
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
34 deletions
+25
-34
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+0
-18
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastDetailsView.swift
+13
-10
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastView.swift
+12
-6
No files found.
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
cfb301df
...
...
@@ -3,22 +3,4 @@
uuid =
"55281C35-FE9F-4CED-865E-FBED0E7393F6"
type =
"0"
version =
"2.0"
>
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"451CF0CC-97B9-44A7-9228-3653F9EC81B0"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastView.swift"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"250"
endingLineNumber =
"250"
landmarkName =
"scrollViewDidScroll(_:)"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastDetailsView.swift
View file @
cfb301df
...
...
@@ -49,12 +49,19 @@ class MinutelyForecastDetailsView: UIView {
triangle
.
path
=
path
}
func
configure
(
hourly
:
HourlyWeather
,
colors
:
[
UIColor
])
{
func
configure
(
valueStirng
:
String
,
date
:
Date
?
,
colors
:
[
UIColor
])
{
gradient
.
colors
=
colors
.
map
{
$0
.
cgColor
}
triangle
.
fillColor
=
colors
.
last
?
.
cgColor
timeLabel
.
text
=
formatter
.
string
(
from
:
hourly
.
date
)
tempLabel
.
text
=
hourly
.
temp
?
.
settingsConverted
.
shortString
forecastImage
.
image
=
hourly
.
type
.
image
(
isDay
:
hourly
.
isDay
)
if
let
forecastDate
=
date
{
timeLabel
.
text
=
formatter
.
string
(
from
:
forecastDate
)
}
else
{
timeLabel
.
text
=
"--"
}
tempLabel
.
text
=
valueStirng
forecastImage
.
image
=
nil
}
}
...
...
@@ -84,10 +91,6 @@ private extension MinutelyForecastDetailsView {
container
.
addSubview
(
separator
)
//Constraints
self
.
snp
.
makeConstraints
{
make
in
make
.
height
.
equalTo
(
38
)
}
container
.
snp
.
makeConstraints
{
make
in
make
.
left
.
top
.
right
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
triangleView
.
snp
.
top
)
...
...
@@ -101,7 +104,7 @@ private extension MinutelyForecastDetailsView {
separator
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
1
)
make
.
height
.
equalToSuperview
()
.
multipliedBy
(
0.65
)
make
.
left
.
equalTo
(
timeLabel
.
snp
.
right
)
.
offset
(
8
)
make
.
left
.
equalTo
Superview
()
.
inset
(
70
)
make
.
centerY
.
equalToSuperview
()
}
...
...
@@ -113,7 +116,7 @@ private extension MinutelyForecastDetailsView {
forecastImage
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
28
)
make
.
centerY
.
equalToSuperview
()
make
.
left
.
equalTo
(
tempLabel
.
snp
.
right
)
.
offset
(
4
)
//
make.left.equalTo(tempLabel.snp.right).offset(4)
make
.
right
.
equalToSuperview
()
.
inset
(
12
)
}
}
...
...
1Weather/UI/SharedViews/MinutelyForecastView/MinutelyForecastView.swift
View file @
cfb301df
...
...
@@ -75,9 +75,12 @@ class MinutelyForecastView: UIView {
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
let
leftInset
=
detailsInfoView
.
frame
.
origin
.
x
-
scrollView
.
frame
.
origin
.
x
+
detailsInfoView
.
frame
.
width
/
2
scrollView
.
contentInset
=
.
init
(
top
:
0
,
left
:
leftInset
,
bottom
:
0
,
right
:
leftInset
+
20
)
scrollView
.
setContentOffset
(
.
init
(
x
:
-
leftInset
,
y
:
0
),
animated
:
false
)
if
scrollView
.
contentInset
.
left
!=
leftInset
{
scrollView
.
contentInset
=
.
init
(
top
:
0
,
left
:
leftInset
,
bottom
:
0
,
right
:
leftInset
+
20
)
scrollView
.
setContentOffset
(
.
init
(
x
:
-
leftInset
,
y
:
0
),
animated
:
false
)
}
//Dash
let
dashlinePath
=
CGMutablePath
()
...
...
@@ -92,7 +95,8 @@ class MinutelyForecastView: UIView {
self
.
location
=
location
centerDashline
.
strokeColor
=
kTemperatureColors
.
last
?
.
cgColor
if
!
location
.
hourly
.
isEmpty
{
self
.
detailsInfoView
.
configure
(
hourly
:
location
.
hourly
[
0
],
self
.
detailsInfoView
.
configure
(
valueStirng
:
location
.
hourly
.
first
?
.
temp
?
.
shortString
??
"--"
,
date
:
location
.
hourly
.
first
?
.
date
,
colors
:
kTemperatureColors
)
}
...
...
@@ -182,6 +186,8 @@ private extension MinutelyForecastView {
//Constraints
detailsInfoView
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
158
)
make
.
height
.
equalTo
(
50
)
make
.
top
.
equalToSuperview
()
make
.
centerX
.
equalToSuperview
()
}
...
...
@@ -243,10 +249,10 @@ extension MinutelyForecastView: UIScrollViewDelegate {
return
}
if
0
..<
cachedValue
.
key
~=
location
?
.
minutely
?
.
forecast
.
count
??
0
{
let
forecast
=
location
?
.
minutely
?
.
forecast
[
cachedValue
.
key
]
detailsInfoView
.
configure
(
hourly
:
forecast
,
colors
:
<
#
T
##
[
UIColor
]
#
>
)
}
detailsInfoView
.
configure
(
valueStirng
:
forecast
?
.
temp
.
shortString
??
"--"
,
date
:
forecast
?
.
time
,
colors
:
kTemperatureColors
)
print
(
"[min] Target current index
\(
cachedValue
.
key
)
"
)
}
}
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