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
cbdfe4ca
Commit
cbdfe4ca
authored
Mar 23, 2021
by
Dmitriy Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started implementing dark mode
parent
bb0e57d7
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
108 additions
and
19 deletions
+108
-19
1Weather.xcodeproj/project.pbxproj
+4
-0
1Weather.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
+1
-1
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
1Weather/Extensions/UIView+InterfaceStyle.swift
+24
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/background_color.colorset/Contents.json
+3
-3
1Weather/Resources/OneWeatherColorsAsset.xcassets/container_background_color.colorset/Contents.json
+38
-0
1Weather/Resources/OneWeatherColorsAsset.xcassets/secondary_text_color.colorset/Contents.json
+3
-3
1Weather/UI/Helpers/Themes/DefaultTheme.swift
+4
-0
1Weather/UI/Helpers/Themes/ThemeProtocol.swift
+1
-0
1Weather/UI/View controllers/Today/Cells/CityForecastCell.swift
+18
-7
1Weather/UI/View controllers/Today/Cells/TodayAdCell.swift
+11
-4
Pods/Pods.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
+1
-1
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
cbdfe4ca
...
...
@@ -22,6 +22,7 @@
CD1DDD332602305200AC62B2
/* ForecastInfoCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1DDD322602305200AC62B2
/* ForecastInfoCell.swift */
;
};
CD251ED82603633800ED7A65
/* ForecastPrecipitationCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD251ED72603633800ED7A65
/* ForecastPrecipitationCell.swift */
;
};
CD251EDC26036E5400ED7A65
/* DayTimePrecipitationView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD251EDB26036E5400ED7A65
/* DayTimePrecipitationView.swift */
;
};
CD2B2140260A366B00AB918A
/* UIView+InterfaceStyle.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD2B213F260A366B00AB918A
/* UIView+InterfaceStyle.swift */
;
};
CD35DFCC260341B000F2138F
/* Calendar+TimeZone.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD35DFCB260341B000F2138F
/* Calendar+TimeZone.swift */
;
};
CD35DFD0260344A500F2138F
/* ForecastConditionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD35DFCF260344A500F2138F
/* ForecastConditionView.swift */
;
};
CD35DFD426034BCD00F2138F
/* UIStackView+RemoveAll.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD35DFD326034BCD00F2138F
/* UIStackView+RemoveAll.swift */
;
};
...
...
@@ -125,6 +126,7 @@
CD1DDD322602305200AC62B2
/* ForecastInfoCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastInfoCell.swift
;
sourceTree
=
"<group>"
;
};
CD251ED72603633800ED7A65
/* ForecastPrecipitationCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastPrecipitationCell.swift
;
sourceTree
=
"<group>"
;
};
CD251EDB26036E5400ED7A65
/* DayTimePrecipitationView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DayTimePrecipitationView.swift
;
sourceTree
=
"<group>"
;
};
CD2B213F260A366B00AB918A
/* UIView+InterfaceStyle.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIView+InterfaceStyle.swift"
;
sourceTree
=
"<group>"
;
};
CD35DFCB260341B000F2138F
/* Calendar+TimeZone.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Calendar+TimeZone.swift"
;
sourceTree
=
"<group>"
;
};
CD35DFCF260344A500F2138F
/* ForecastConditionView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastConditionView.swift
;
sourceTree
=
"<group>"
;
};
CD35DFD326034BCD00F2138F
/* UIStackView+RemoveAll.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIStackView+RemoveAll.swift"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -296,6 +298,7 @@
CD35DFD326034BCD00F2138F
/* UIStackView+RemoveAll.swift */
,
CD593BC826089FC100C93428
/* UITableView+HeaderSize.swift */
,
CD593BDB2608CDF100C93428
/* Date+Now.swift */
,
CD2B213F260A366B00AB918A
/* UIView+InterfaceStyle.swift */
,
);
path
=
Extensions
;
sourceTree
=
"<group>"
;
...
...
@@ -760,6 +763,7 @@
CD86C22225F0DCCB00F38A16
/* PrecipitationView.swift in Sources */
,
CD17C5FF25D15B7C00EE884E
/* TodayCoordinator.swift in Sources */
,
CD822FF525D6817000A05501
/* CityForecastCell.swift in Sources */
,
CD2B2140260A366B00AB918A
/* UIView+InterfaceStyle.swift in Sources */
,
CEDE4E8525EEFD56007457E9
/* WdtHourlySummariesArray.swift in Sources */
,
CDC6125725E7AB1A00188DA7
/* CityAirQualityCell.swift in Sources */
,
CD593BCF2608A50900C93428
/* ForecastHourlyCell.swift in Sources */
,
...
...
1Weather.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
cbdfe4ca
...
...
@@ -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
>
5
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
6
<
/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/UserInterfaceState.xcuserstate
View file @
cbdfe4ca
No preview for this file type
1Weather/Extensions/UIView+InterfaceStyle.swift
0 → 100644
View file @
cbdfe4ca
//
// UIView+Mode.swift
// 1Weather
//
// Created by Dmitry Stepanets on 23.03.2021.
//
import
UIKit
public
enum
AppInterfaceStyle
{
case
light
case
dark
}
extension
UIView
{
var
interfaceStyle
:
AppInterfaceStyle
{
if
#available(iOS 12.0, *)
{
return
traitCollection
.
userInterfaceStyle
==
.
light
?
.
light
:
.
dark
}
else
{
return
.
light
}
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/background_color.colorset/Contents.json
View file @
cbdfe4ca
...
...
@@ -23,9 +23,9 @@
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0x1
3
"
,
"green"
:
"0x1
3
"
,
"red"
:
"0x1
3
"
"blue"
:
"0x1
A
"
,
"green"
:
"0x1
7
"
,
"red"
:
"0x1
7
"
}
},
"idiom"
:
"universal"
...
...
1Weather/Resources/OneWeatherColorsAsset.xcassets/container_background_color.colorset/Contents.json
0 → 100644
View file @
cbdfe4ca
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"1.000"
,
"green"
:
"1.000"
,
"red"
:
"1.000"
}
},
"idiom"
:
"universal"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"color"
:
{
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0x2B"
,
"green"
:
"0x26"
,
"red"
:
"0x26"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
1Weather/Resources/OneWeatherColorsAsset.xcassets/secondary_text_color.colorset/Contents.json
View file @
cbdfe4ca
...
...
@@ -23,9 +23,9 @@
"color-space"
:
"srgb"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"
105
"
,
"green"
:
"
79
"
,
"red"
:
"
70
"
"blue"
:
"
0xEC
"
,
"green"
:
"
0xE0
"
,
"red"
:
"
0xCA
"
}
},
"idiom"
:
"universal"
...
...
1Weather/UI/Helpers/Themes/DefaultTheme.swift
View file @
cbdfe4ca
...
...
@@ -17,6 +17,10 @@ struct DefaultTheme: ThemeProtocol {
return
UIColor
(
named
:
"background_color"
)
??
.
red
}
var
containerBackgroundColor
:
UIColor
{
return
UIColor
(
named
:
"container_background_color"
)
??
.
red
}
//Navigation bar
var
navigationBarBackgroundColor
:
UIColor
{
return
baseBackgroundColor
...
...
1Weather/UI/Helpers/Themes/ThemeProtocol.swift
View file @
cbdfe4ca
...
...
@@ -11,6 +11,7 @@ protocol ThemeProtocol {
//Base
var
name
:
String
{
get
}
var
baseBackgroundColor
:
UIColor
{
get
}
var
containerBackgroundColor
:
UIColor
{
get
}
//Navigation bar
var
navigationBarBackgroundColor
:
UIColor
{
get
}
...
...
1Weather/UI/View controllers/Today/Cells/CityForecastCell.swift
View file @
cbdfe4ca
...
...
@@ -20,7 +20,7 @@ class CityForecastCell: UITableViewCell {
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
prepareCell
Style
()
prepareCell
()
prepareContainer
()
prepareCityImage
()
prepareTemperatureLabel
()
...
...
@@ -47,18 +47,29 @@ class CityForecastCell: UITableViewCell {
//MARK:- Prepare
private
extension
CityForecastCell
{
func
prepareCell
Style
()
{
func
prepareCell
()
{
selectionStyle
=
.
none
contentView
.
backgroundColor
=
ThemeManager
.
currentTheme
.
baseBackgroundColor
}
func
prepareContainer
()
{
container
.
backgroundColor
=
.
white
container
.
clipsToBounds
=
false
container
.
backgroundColor
=
ThemeManager
.
currentTheme
.
containerBackgroundColor
if
self
.
interfaceStyle
==
.
light
{
container
.
layer
.
shadowColor
=
UIColor
(
hex
:
0x020116
)
.
cgColor
container
.
layer
.
shadowOffset
=
.
init
(
width
:
0
,
height
:
10
)
container
.
layer
.
shadowRadius
=
20
container
.
layer
.
shadowOpacity
=
0.12
}
else
{
container
.
layer
.
shadowColor
=
UIColor
.
black
.
cgColor
container
.
layer
.
shadowOffset
=
.
init
(
width
:
8
,
height
:
8
)
container
.
layer
.
shadowRadius
=
8
container
.
layer
.
shadowOpacity
=
1.0
}
container
.
layer
.
cornerRadius
=
12
container
.
layer
.
shadowColor
=
UIColor
(
hex
:
0x020116
)
.
cgColor
container
.
layer
.
shadowOffset
=
.
init
(
width
:
0
,
height
:
10
)
container
.
layer
.
shadowRadius
=
20
container
.
layer
.
shadowOpacity
=
0.12
contentView
.
addSubview
(
container
)
container
.
snp
.
makeConstraints
{
(
make
)
in
...
...
1Weather/UI/View controllers/Today/Cells/TodayAdCell.swift
View file @
cbdfe4ca
...
...
@@ -20,7 +20,10 @@ class TodayAdCell: UITableViewCell {
prepareCellStyle
()
prepareContainer
()
prepareAd
()
prepareGradient
()
if
self
.
interfaceStyle
==
.
light
{
prepareGradient
()
}
}
required
init
?(
coder
:
NSCoder
)
{
...
...
@@ -36,10 +39,14 @@ private extension TodayAdCell {
}
func
prepareContainer
()
{
container
.
backgroundColor
=
.
white
container
.
backgroundColor
=
ThemeManager
.
currentTheme
.
containerBackgroundColor
container
.
layer
.
cornerRadius
=
6
container
.
layer
.
borderWidth
=
1
/
UIScreen
.
main
.
scale
container
.
layer
.
borderColor
=
UIColor
(
hex
:
0xc7c7c7
)
.
cgColor
if
self
.
interfaceStyle
==
.
light
{
container
.
layer
.
borderWidth
=
1
/
UIScreen
.
main
.
scale
container
.
layer
.
borderColor
=
UIColor
(
hex
:
0xc7c7c7
)
.
cgColor
}
contentView
.
addSubview
(
container
)
container
.
snp
.
makeConstraints
{
(
make
)
in
...
...
Pods/Pods.xcodeproj/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
cbdfe4ca
...
...
@@ -52,7 +52,7 @@
<
k
e
y
>
XMLCoder.xcscheme_
^#
shared
#^
_
<
/k
e
y
>
<
d
i
c
t
>
<
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
>
<
/
d
i
c
t
>
<
k
e
y
>
SuppressBuildableAutocreation
<
/k
e
y
>
...
...
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