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
1d9efe87
Commit
1d9efe87
authored
Jul 01, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IOS-72: refactor small widget to extract views shared with bigger widgets.
parent
4de104bf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
161 additions
and
58 deletions
+161
-58
1Weather.xcodeproj/project.pbxproj
+41
-12
OneWeatherWidget/Assets.xcassets/Colors/Contents.json
+6
-0
OneWeatherWidget/Assets.xcassets/Colors/HighLowTemperatureColor.colorset/Contents.json
+20
-0
OneWeatherWidget/OneWeatherWidgetsBundle.swift
+15
-0
OneWeatherWidget/UI/WidgetPlaceholderView.swift
+2
-2
OneWeatherWidget/UI/WidgetViews/CityNameView.swift
+29
-0
OneWeatherWidget/UI/WidgetViews/HighLowTemperatureView.swift
+24
-0
OneWeatherWidget/UI/WidgetViews/SmallTemperatureWidgetView.swift
+19
-38
OneWeatherWidget/ViewModels/ForecastWidgetViewModel.swift
+2
-2
OneWeatherWidget/Widgets/SmallTemperatureWidget.swift
+3
-4
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
1d9efe87
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
CD18728B2624763000AFEDAA
/* MapLegendView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD18728A2624763000AFEDAA
/* MapLegendView.swift */
;
};
CD18728B2624763000AFEDAA
/* MapLegendView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD18728A2624763000AFEDAA
/* MapLegendView.swift */
;
};
CD1B713B2660F95000916E71
/* WidgetKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B713A2660F95000916E71
/* WidgetKit.framework */
;
};
CD1B713B2660F95000916E71
/* WidgetKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B713A2660F95000916E71
/* WidgetKit.framework */
;
};
CD1B713D2660F95000916E71
/* SwiftUI.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B713C2660F95000916E71
/* SwiftUI.framework */
;
};
CD1B713D2660F95000916E71
/* SwiftUI.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B713C2660F95000916E71
/* SwiftUI.framework */
;
};
CD1B71402660F95000916E71
/*
OneWeatherWidget.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B713F2660F95000916E71
/* OneWeather
Widget.swift */
;
};
CD1B71402660F95000916E71
/*
SmallTemperatureWidget.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B713F2660F95000916E71
/* SmallTemperature
Widget.swift */
;
};
CD1B71422660F95300916E71
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B71412660F95300916E71
/* Assets.xcassets */
;
};
CD1B71422660F95300916E71
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B71412660F95300916E71
/* Assets.xcassets */
;
};
CD1B71462660F95300916E71
/* OneWeatherWidgetExtension.appex in Embed App Extensions */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B71392660F95000916E71
/* OneWeatherWidgetExtension.appex */
;
settings
=
{
ATTRIBUTES
=
(
RemoveHeadersOnCopy
,
);
};
};
CD1B71462660F95300916E71
/* OneWeatherWidgetExtension.appex in Embed App Extensions */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1B71392660F95000916E71
/* OneWeatherWidgetExtension.appex */
;
settings
=
{
ATTRIBUTES
=
(
RemoveHeadersOnCopy
,
);
};
};
CD1DDD30260218AE00AC62B2
/* DaysControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1DDD2F260218AE00AC62B2
/* DaysControlView.swift */
;
};
CD1DDD30260218AE00AC62B2
/* DaysControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1DDD2F260218AE00AC62B2
/* DaysControlView.swift */
;
};
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
CD39F2F525DE9571009FE398
/* ArrowButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD39F2F425DE9571009FE398
/* ArrowButton.swift */
;
};
CD39F2F525DE9571009FE398
/* ArrowButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD39F2F425DE9571009FE398
/* ArrowButton.swift */
;
};
CD3F6E6925FA59D4002DB99B
/* ForecastDetailPeriodButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD3F6E6825FA59D4002DB99B
/* ForecastDetailPeriodButton.swift */
;
};
CD3F6E6925FA59D4002DB99B
/* ForecastDetailPeriodButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD3F6E6825FA59D4002DB99B
/* ForecastDetailPeriodButton.swift */
;
};
CD3F6E6C25FA5A90002DB99B
/* PeriodButtonProtocol.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD3F6E6B25FA5A90002DB99B
/* PeriodButtonProtocol.swift */
;
};
CD3F6E6C25FA5A90002DB99B
/* PeriodButtonProtocol.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD3F6E6B25FA5A90002DB99B
/* PeriodButtonProtocol.swift */
;
};
CD415D9D2668FDB400177515
/* Small
WidgetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD415D9C2668FDB400177515
/* Small
WidgetView.swift */
;
};
CD415D9D2668FDB400177515
/* Small
TemperatureWidgetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD415D9C2668FDB400177515
/* SmallTemperature
WidgetView.swift */
;
};
CD415DA32668FFF300177515
/* WeatherProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD415DA22668FFF300177515
/* WeatherProvider.swift */
;
};
CD415DA32668FFF300177515
/* WeatherProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD415DA22668FFF300177515
/* WeatherProvider.swift */
;
};
CD4742D0261200500061AC95
/* TodayAlertCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD4742CF261200500061AC95
/* TodayAlertCell.swift */
;
};
CD4742D0261200500061AC95
/* TodayAlertCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD4742CF261200500061AC95
/* TodayAlertCell.swift */
;
};
CD483A942664D64A00CA53AB
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1237CB255D5C5C00C98139
/* Assets.xcassets */
;
};
CD483A942664D64A00CA53AB
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD1237CB255D5C5C00C98139
/* Assets.xcassets */
;
};
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
CD483A9E2664E08200CA53AB
/* SF-Pro-Display-Regular.otf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD483A9C2664E08200CA53AB
/* SF-Pro-Display-Regular.otf */
;
};
CD483A9E2664E08200CA53AB
/* SF-Pro-Display-Regular.otf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD483A9C2664E08200CA53AB
/* SF-Pro-Display-Regular.otf */
;
};
CD5293D8266908DB009547C8
/* WidgetPlaceholderView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293D7266908DB009547C8
/* WidgetPlaceholderView.swift */
;
};
CD5293D8266908DB009547C8
/* WidgetPlaceholderView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293D7266908DB009547C8
/* WidgetPlaceholderView.swift */
;
};
CD5293DA2669094E009547C8
/* WeatherEntry.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293D92669094E009547C8
/* WeatherEntry.swift */
;
};
CD5293DA2669094E009547C8
/* WeatherEntry.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293D92669094E009547C8
/* WeatherEntry.swift */
;
};
CD5293DF266A235F009547C8
/*
SmallWidgetViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293DE266A235F009547C8
/* Small
WidgetViewModel.swift */
;
};
CD5293DF266A235F009547C8
/*
ForecastWidgetViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293DE266A235F009547C8
/* Forecast
WidgetViewModel.swift */
;
};
CD5293E0266A30EE009547C8
/* Localizable.strings in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD75F0F25DE68B10099ACDB
/* Localizable.strings */
;
};
CD5293E0266A30EE009547C8
/* Localizable.strings in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD75F0F25DE68B10099ACDB
/* Localizable.strings */
;
};
CD5293E1266A4258009547C8
/* AppFont.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD0F1E72572429E00CF5017
/* AppFont.swift */
;
};
CD5293E1266A4258009547C8
/* AppFont.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDD0F1E72572429E00CF5017
/* AppFont.swift */
;
};
CD5293E3266A4340009547C8
/* UIFont+Font.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293E2266A4340009547C8
/* UIFont+Font.swift */
;
};
CD5293E3266A4340009547C8
/* UIFont+Font.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD5293E2266A4340009547C8
/* UIFont+Font.swift */
;
};
...
@@ -196,10 +196,14 @@
...
@@ -196,10 +196,14 @@
CE14445F2638B6CF008E2162
/* StoreKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE14445E2638B6CF008E2162
/* StoreKit.framework */
;
};
CE14445F2638B6CF008E2162
/* StoreKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE14445E2638B6CF008E2162
/* StoreKit.framework */
;
};
CE30E37F2668FBE3006DF5CD
/* OneWeatherAnalytics.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE30E37E2668FBE3006DF5CD
/* OneWeatherAnalytics.framework */
;
};
CE30E37F2668FBE3006DF5CD
/* OneWeatherAnalytics.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE30E37E2668FBE3006DF5CD
/* OneWeatherAnalytics.framework */
;
};
CE30E3802668FBE3006DF5CD
/* OneWeatherAnalytics.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE30E37E2668FBE3006DF5CD
/* OneWeatherAnalytics.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
CE30E3802668FBE3006DF5CD
/* OneWeatherAnalytics.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE30E37E2668FBE3006DF5CD
/* OneWeatherAnalytics.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
CE367270268DB88100D8B69E
/* HighLowTemperatureView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE36726F268DB88100D8B69E
/* HighLowTemperatureView.swift */
;
};
CE367272268DCD6000D8B69E
/* CityNameView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE367271268DCD6000D8B69E
/* CityNameView.swift */
;
};
CE376C98261EE484000B1159
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE376C97261EE484000B1159
/* LaunchScreen.storyboard */
;
};
CE376C98261EE484000B1159
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE376C97261EE484000B1159
/* LaunchScreen.storyboard */
;
};
CE578FE525FB415F00E8B85D
/* CityCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE578FE225FB415F00E8B85D
/* CityCell.swift */
;
};
CE578FE525FB415F00E8B85D
/* CityCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE578FE225FB415F00E8B85D
/* CityCell.swift */
;
};
CE578FE625FB415F00E8B85D
/* LocationViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE578FE325FB415F00E8B85D
/* LocationViewController.swift */
;
};
CE578FE625FB415F00E8B85D
/* LocationViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE578FE325FB415F00E8B85D
/* LocationViewController.swift */
;
};
CE578FE725FB415F00E8B85D
/* LocationsViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE578FE425FB415F00E8B85D
/* LocationsViewModel.swift */
;
};
CE578FE725FB415F00E8B85D
/* LocationsViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE578FE425FB415F00E8B85D
/* LocationsViewModel.swift */
;
};
CE5F0CBA268A02C100B99572
/* OneWeatherMediumTemperatureWidget.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE5F0CB9268A02C100B99572
/* OneWeatherMediumTemperatureWidget.swift */
;
};
CE5F0CBC268A031800B99572
/* OneWeatherWidgetsBundle.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE5F0CBB268A031800B99572
/* OneWeatherWidgetsBundle.swift */
;
};
CE6BE4942634170800626822
/* USStateCode.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE6BE4932634170800626822
/* USStateCode.swift */
;
};
CE6BE4942634170800626822
/* USStateCode.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE6BE4932634170800626822
/* USStateCode.swift */
;
};
CE6F5F0C263C8B3D00973137
/* SmartTextProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE6F5F0B263C8B3C00973137
/* SmartTextProvider.swift */
;
};
CE6F5F0C263C8B3D00973137
/* SmartTextProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE6F5F0B263C8B3C00973137
/* SmartTextProvider.swift */
;
};
CE7298C9267A34F3002745D0
/* BlendFIPSSource.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CEEF40FF265E47FF00425D8F
/* BlendFIPSSource.framework */
;
};
CE7298C9267A34F3002745D0
/* BlendFIPSSource.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CEEF40FF265E47FF00425D8F
/* BlendFIPSSource.framework */
;
};
...
@@ -336,7 +340,7 @@
...
@@ -336,7 +340,7 @@
CD1B71392660F95000916E71
/* OneWeatherWidgetExtension.appex */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
"wrapper.app-extension"
;
includeInIndex
=
0
;
path
=
OneWeatherWidgetExtension.appex
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
CD1B71392660F95000916E71
/* OneWeatherWidgetExtension.appex */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
"wrapper.app-extension"
;
includeInIndex
=
0
;
path
=
OneWeatherWidgetExtension.appex
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
CD1B713A2660F95000916E71
/* WidgetKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
WidgetKit.framework
;
path
=
System/Library/Frameworks/WidgetKit.framework
;
sourceTree
=
SDKROOT
;
};
CD1B713A2660F95000916E71
/* WidgetKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
WidgetKit.framework
;
path
=
System/Library/Frameworks/WidgetKit.framework
;
sourceTree
=
SDKROOT
;
};
CD1B713C2660F95000916E71
/* SwiftUI.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
SwiftUI.framework
;
path
=
System/Library/Frameworks/SwiftUI.framework
;
sourceTree
=
SDKROOT
;
};
CD1B713C2660F95000916E71
/* SwiftUI.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
SwiftUI.framework
;
path
=
System/Library/Frameworks/SwiftUI.framework
;
sourceTree
=
SDKROOT
;
};
CD1B713F2660F95000916E71
/*
OneWeatherWidget.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
OneWeather
Widget.swift
;
sourceTree
=
"<group>"
;
};
CD1B713F2660F95000916E71
/*
SmallTemperatureWidget.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SmallTemperature
Widget.swift
;
sourceTree
=
"<group>"
;
};
CD1B71412660F95300916E71
/* Assets.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
Assets.xcassets
;
sourceTree
=
"<group>"
;
};
CD1B71412660F95300916E71
/* Assets.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
Assets.xcassets
;
sourceTree
=
"<group>"
;
};
CD1B71432660F95300916E71
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
CD1B71432660F95300916E71
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
CD1DDD2F260218AE00AC62B2
/* DaysControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DaysControlView.swift
;
sourceTree
=
"<group>"
;
};
CD1DDD2F260218AE00AC62B2
/* DaysControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DaysControlView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -370,14 +374,14 @@
...
@@ -370,14 +374,14 @@
CD39F2F425DE9571009FE398
/* ArrowButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ArrowButton.swift
;
sourceTree
=
"<group>"
;
};
CD39F2F425DE9571009FE398
/* ArrowButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ArrowButton.swift
;
sourceTree
=
"<group>"
;
};
CD3F6E6825FA59D4002DB99B
/* ForecastDetailPeriodButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastDetailPeriodButton.swift
;
sourceTree
=
"<group>"
;
};
CD3F6E6825FA59D4002DB99B
/* ForecastDetailPeriodButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ForecastDetailPeriodButton.swift
;
sourceTree
=
"<group>"
;
};
CD3F6E6B25FA5A90002DB99B
/* PeriodButtonProtocol.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PeriodButtonProtocol.swift
;
sourceTree
=
"<group>"
;
};
CD3F6E6B25FA5A90002DB99B
/* PeriodButtonProtocol.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PeriodButtonProtocol.swift
;
sourceTree
=
"<group>"
;
};
CD415D9C2668FDB400177515
/* Small
WidgetView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Small
WidgetView.swift
;
sourceTree
=
"<group>"
;
};
CD415D9C2668FDB400177515
/* Small
TemperatureWidgetView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SmallTemperature
WidgetView.swift
;
sourceTree
=
"<group>"
;
};
CD415DA22668FFF300177515
/* WeatherProvider.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WeatherProvider.swift
;
sourceTree
=
"<group>"
;
};
CD415DA22668FFF300177515
/* WeatherProvider.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WeatherProvider.swift
;
sourceTree
=
"<group>"
;
};
CD4742CF261200500061AC95
/* TodayAlertCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TodayAlertCell.swift
;
sourceTree
=
"<group>"
;
};
CD4742CF261200500061AC95
/* TodayAlertCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TodayAlertCell.swift
;
sourceTree
=
"<group>"
;
};
CD483A992664DF7300CA53AB
/* SF-Pro-Display-Light.otf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"SF-Pro-Display-Light.otf"
;
sourceTree
=
"<group>"
;
};
CD483A992664DF7300CA53AB
/* SF-Pro-Display-Light.otf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"SF-Pro-Display-Light.otf"
;
sourceTree
=
"<group>"
;
};
CD483A9C2664E08200CA53AB
/* SF-Pro-Display-Regular.otf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"SF-Pro-Display-Regular.otf"
;
sourceTree
=
"<group>"
;
};
CD483A9C2664E08200CA53AB
/* SF-Pro-Display-Regular.otf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"SF-Pro-Display-Regular.otf"
;
sourceTree
=
"<group>"
;
};
CD5293D7266908DB009547C8
/* WidgetPlaceholderView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WidgetPlaceholderView.swift
;
sourceTree
=
"<group>"
;
};
CD5293D7266908DB009547C8
/* WidgetPlaceholderView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WidgetPlaceholderView.swift
;
sourceTree
=
"<group>"
;
};
CD5293D92669094E009547C8
/* WeatherEntry.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WeatherEntry.swift
;
sourceTree
=
"<group>"
;
};
CD5293D92669094E009547C8
/* WeatherEntry.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WeatherEntry.swift
;
sourceTree
=
"<group>"
;
};
CD5293DE266A235F009547C8
/*
SmallWidgetViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Small
WidgetViewModel.swift
;
sourceTree
=
"<group>"
;
};
CD5293DE266A235F009547C8
/*
ForecastWidgetViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Forecast
WidgetViewModel.swift
;
sourceTree
=
"<group>"
;
};
CD5293E2266A4340009547C8
/* UIFont+Font.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIFont+Font.swift"
;
sourceTree
=
"<group>"
;
};
CD5293E2266A4340009547C8
/* UIFont+Font.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIFont+Font.swift"
;
sourceTree
=
"<group>"
;
};
CD5293EB266A5BC2009547C8
/* UIColor+Color.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIColor+Color.swift"
;
sourceTree
=
"<group>"
;
};
CD5293EB266A5BC2009547C8
/* UIColor+Color.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"UIColor+Color.swift"
;
sourceTree
=
"<group>"
;
};
CD55E0BA2615EE2400CC4DC7
/* PollutantView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PollutantView.swift
;
sourceTree
=
"<group>"
;
};
CD55E0BA2615EE2400CC4DC7
/* PollutantView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PollutantView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -492,10 +496,13 @@
...
@@ -492,10 +496,13 @@
CE14445E2638B6CF008E2162
/* StoreKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
StoreKit.framework
;
path
=
System/Library/Frameworks/StoreKit.framework
;
sourceTree
=
SDKROOT
;
};
CE14445E2638B6CF008E2162
/* StoreKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
StoreKit.framework
;
path
=
System/Library/Frameworks/StoreKit.framework
;
sourceTree
=
SDKROOT
;
};
CE30E37E2668FBE3006DF5CD
/* OneWeatherAnalytics.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
path
=
OneWeatherAnalytics.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
CE30E37E2668FBE3006DF5CD
/* OneWeatherAnalytics.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
path
=
OneWeatherAnalytics.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
CE35F60E2681FA27008D507E
/* OneWeatherWidgetExtension.entitlements */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.entitlements
;
path
=
OneWeatherWidgetExtension.entitlements
;
sourceTree
=
"<group>"
;
};
CE35F60E2681FA27008D507E
/* OneWeatherWidgetExtension.entitlements */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.entitlements
;
path
=
OneWeatherWidgetExtension.entitlements
;
sourceTree
=
"<group>"
;
};
CE36726F268DB88100D8B69E
/* HighLowTemperatureView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HighLowTemperatureView.swift
;
sourceTree
=
"<group>"
;
};
CE367271268DCD6000D8B69E
/* CityNameView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CityNameView.swift
;
sourceTree
=
"<group>"
;
};
CE376C97261EE484000B1159
/* LaunchScreen.storyboard */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.storyboard
;
path
=
LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
CE376C97261EE484000B1159
/* LaunchScreen.storyboard */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
file.storyboard
;
path
=
LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
CE578FE225FB415F00E8B85D
/* CityCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CityCell.swift
;
sourceTree
=
"<group>"
;
};
CE578FE225FB415F00E8B85D
/* CityCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CityCell.swift
;
sourceTree
=
"<group>"
;
};
CE578FE325FB415F00E8B85D
/* LocationViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LocationViewController.swift
;
sourceTree
=
"<group>"
;
};
CE578FE325FB415F00E8B85D
/* LocationViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LocationViewController.swift
;
sourceTree
=
"<group>"
;
};
CE578FE425FB415F00E8B85D
/* LocationsViewModel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LocationsViewModel.swift
;
sourceTree
=
"<group>"
;
};
CE578FE425FB415F00E8B85D
/* LocationsViewModel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
LocationsViewModel.swift
;
sourceTree
=
"<group>"
;
};
CE5F0CBB268A031800B99572
/* OneWeatherWidgetsBundle.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
OneWeatherWidgetsBundle.swift
;
sourceTree
=
"<group>"
;
};
CE6BE4932634170800626822
/* USStateCode.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
USStateCode.swift
;
sourceTree
=
"<group>"
;
};
CE6BE4932634170800626822
/* USStateCode.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
USStateCode.swift
;
sourceTree
=
"<group>"
;
};
CE6F5F0B263C8B3C00973137
/* SmartTextProvider.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SmartTextProvider.swift
;
sourceTree
=
"<group>"
;
};
CE6F5F0B263C8B3C00973137
/* SmartTextProvider.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SmartTextProvider.swift
;
sourceTree
=
"<group>"
;
};
CE81A421266E289E00800EFF
/* NativeAdView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NativeAdView.swift
;
sourceTree
=
"<group>"
;
};
CE81A421266E289E00800EFF
/* NativeAdView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NativeAdView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -684,9 +691,10 @@
...
@@ -684,9 +691,10 @@
CD5293DD266A2345009547C8
/* ViewModels */
,
CD5293DD266A2345009547C8
/* ViewModels */
,
CD5293DC266909B0009547C8
/* Data */
,
CD5293DC266909B0009547C8
/* Data */
,
CD5293DB2669099B009547C8
/* UI */
,
CD5293DB2669099B009547C8
/* UI */
,
C
D1B713F2660F95000916E71
/* OneWeatherWidget.swift
*/
,
C
E5F0CBD268A058700B99572
/* Widgets
*/
,
CD1B71412660F95300916E71
/* Assets.xcassets */
,
CD1B71412660F95300916E71
/* Assets.xcassets */
,
CD1B71432660F95300916E71
/* Info.plist */
,
CD1B71432660F95300916E71
/* Info.plist */
,
CE5F0CBB268A031800B99572
/* OneWeatherWidgetsBundle.swift */
,
);
);
path
=
OneWeatherWidget
;
path
=
OneWeatherWidget
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -772,9 +780,9 @@
...
@@ -772,9 +780,9 @@
CD5293DB2669099B009547C8
/* UI */
=
{
CD5293DB2669099B009547C8
/* UI */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
CE5F0CBE268A059700B99572
/* WidgetViews */
,
CD5293E2266A4340009547C8
/* UIFont+Font.swift */
,
CD5293E2266A4340009547C8
/* UIFont+Font.swift */
,
CD5293D7266908DB009547C8
/* WidgetPlaceholderView.swift */
,
CD5293D7266908DB009547C8
/* WidgetPlaceholderView.swift */
,
CD415D9C2668FDB400177515
/* SmallWidgetView.swift */
,
CD5293EB266A5BC2009547C8
/* UIColor+Color.swift */
,
CD5293EB266A5BC2009547C8
/* UIColor+Color.swift */
,
CDEF70F5266E25E400BA40D6
/* VectorImage.swift */
,
CDEF70F5266E25E400BA40D6
/* VectorImage.swift */
,
);
);
...
@@ -793,7 +801,7 @@
...
@@ -793,7 +801,7 @@
CD5293DD266A2345009547C8
/* ViewModels */
=
{
CD5293DD266A2345009547C8
/* ViewModels */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
CD5293DE266A235F009547C8
/*
Small
WidgetViewModel.swift */
,
CD5293DE266A235F009547C8
/*
Forecast
WidgetViewModel.swift */
,
);
);
path
=
ViewModels
;
path
=
ViewModels
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -1237,6 +1245,24 @@
...
@@ -1237,6 +1245,24 @@
path
=
Cells
;
path
=
Cells
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
CE5F0CBD268A058700B99572
/* Widgets */
=
{
isa
=
PBXGroup
;
children
=
(
CD1B713F2660F95000916E71
/* SmallTemperatureWidget.swift */
,
);
path
=
Widgets
;
sourceTree
=
"<group>"
;
};
CE5F0CBE268A059700B99572
/* WidgetViews */
=
{
isa
=
PBXGroup
;
children
=
(
CD415D9C2668FDB400177515
/* SmallTemperatureWidgetView.swift */
,
CE36726F268DB88100D8B69E
/* HighLowTemperatureView.swift */
,
CE367271268DCD6000D8B69E
/* CityNameView.swift */
,
);
path
=
WidgetViews
;
sourceTree
=
"<group>"
;
};
CE81A420266E288C00800EFF
/* NativeAdViews */
=
{
CE81A420266E288C00800EFF
/* NativeAdViews */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -1807,15 +1833,18 @@
...
@@ -1807,15 +1833,18 @@
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
CD5293E1266A4258009547C8
/* AppFont.swift in Sources */
,
CD5293E1266A4258009547C8
/* AppFont.swift in Sources */
,
CD5293DF266A235F009547C8
/*
Small
WidgetViewModel.swift in Sources */
,
CD5293DF266A235F009547C8
/*
Forecast
WidgetViewModel.swift in Sources */
,
CD5293D8266908DB009547C8
/* WidgetPlaceholderView.swift in Sources */
,
CD5293D8266908DB009547C8
/* WidgetPlaceholderView.swift in Sources */
,
CD5293E3266A4340009547C8
/* UIFont+Font.swift in Sources */
,
CD5293E3266A4340009547C8
/* UIFont+Font.swift in Sources */
,
CD5293EA266A564E009547C8
/* ThemeProtocol.swift in Sources */
,
CD5293EA266A564E009547C8
/* ThemeProtocol.swift in Sources */
,
CD1B71402660F95000916E71
/* OneWeatherWidget.swift in Sources */
,
CE367270268DB88100D8B69E
/* HighLowTemperatureView.swift in Sources */
,
CD1B71402660F95000916E71
/* SmallTemperatureWidget.swift in Sources */
,
CD5293E8266A561F009547C8
/* DefaultTheme.swift in Sources */
,
CD5293E8266A561F009547C8
/* DefaultTheme.swift in Sources */
,
CD5293E7266A560C009547C8
/* ThemeManager.swift in Sources */
,
CD5293E7266A560C009547C8
/* ThemeManager.swift in Sources */
,
CD415D9D2668FDB400177515
/* SmallWidgetView.swift in Sources */
,
CD415D9D2668FDB400177515
/* SmallTemperatureWidgetView.swift in Sources */
,
CE5F0CBC268A031800B99572
/* OneWeatherWidgetsBundle.swift in Sources */
,
CD5293EC266A5BC2009547C8
/* UIColor+Color.swift in Sources */
,
CD5293EC266A5BC2009547C8
/* UIColor+Color.swift in Sources */
,
CE367272268DCD6000D8B69E
/* CityNameView.swift in Sources */
,
CD415DA32668FFF300177515
/* WeatherProvider.swift in Sources */
,
CD415DA32668FFF300177515
/* WeatherProvider.swift in Sources */
,
CD5293DA2669094E009547C8
/* WeatherEntry.swift in Sources */
,
CD5293DA2669094E009547C8
/* WeatherEntry.swift in Sources */
,
CDEF70F6266E25E400BA40D6
/* VectorImage.swift in Sources */
,
CDEF70F6266E25E400BA40D6
/* VectorImage.swift in Sources */
,
...
...
OneWeatherWidget/Assets.xcassets/Colors/Contents.json
0 → 100644
View file @
1d9efe87
{
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
OneWeatherWidget/Assets.xcassets/Colors/HighLowTemperatureColor.colorset/Contents.json
0 → 100644
View file @
1d9efe87
{
"colors"
:
[
{
"color"
:
{
"color-space"
:
"display-p3"
,
"components"
:
{
"alpha"
:
"1.000"
,
"blue"
:
"0.741"
,
"green"
:
"0.673"
,
"red"
:
"0.656"
}
},
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
OneWeatherWidget/OneWeatherWidgetsBundle.swift
0 → 100644
View file @
1d9efe87
//
// OneWeatherWidgetsBundle.swift
// OneWeatherWidgetExtension
//
// Created by Demid Merzlyakov on 28.06.2021.
//
import
SwiftUI
@main
struct
OneWeatherWidgets
:
WidgetBundle
{
var
body
:
some
Widget
{
SmallTemperatureWidget
()
}
}
OneWeatherWidget/UI/WidgetPlaceholderView.swift
View file @
1d9efe87
...
@@ -14,10 +14,10 @@ struct WidgetPlaceholderView: View {
...
@@ -14,10 +14,10 @@ struct WidgetPlaceholderView: View {
var
body
:
some
View
{
var
body
:
some
View
{
switch
family
{
switch
family
{
case
.
systemSmall
:
case
.
systemSmall
:
SmallWidgetView
(
widgetViewModel
:
.
init
(
location
:
WeatherEntry
.
defaultLocation
))
Small
Temperature
WidgetView
(
widgetViewModel
:
.
init
(
location
:
WeatherEntry
.
defaultLocation
))
.
redacted
(
reason
:
.
placeholder
)
.
redacted
(
reason
:
.
placeholder
)
default
:
default
:
SmallWidgetView
(
widgetViewModel
:
.
init
(
location
:
WeatherEntry
.
defaultLocation
))
Small
Temperature
WidgetView
(
widgetViewModel
:
.
init
(
location
:
WeatherEntry
.
defaultLocation
))
.
redacted
(
reason
:
.
placeholder
)
.
redacted
(
reason
:
.
placeholder
)
}
}
}
}
...
...
OneWeatherWidget/UI/WidgetViews/CityNameView.swift
0 → 100644
View file @
1d9efe87
//
// CityNameView.swift
// OneWeatherWidgetExtension
//
// Created by Demid Merzlyakov on 01.07.2021.
//
import
SwiftUI
struct
CityNameView
:
View
{
@State
public
var
cityName
:
String
@State
public
var
isDeviceLocation
:
Bool
var
body
:
some
View
{
HStack
(
spacing
:
4
)
{
Text
(
cityName
)
.
multilineTextAlignment
(
.
leading
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
foregroundColor
(
ThemeManager
.
currentTheme
.
graphTintColor
.
color
)
Image
(
"location_arrow"
)
.
resizable
()
.
renderingMode
(
.
template
)
.
frame
(
width
:
8
,
height
:
8
,
alignment
:
.
center
)
.
aspectRatio
(
contentMode
:
.
fit
)
.
foregroundColor
(
Color
(
ThemeManager
.
currentTheme
.
graphTintColor
.
cgColor
))
.
opacity
(
isDeviceLocation
?
1
:
0
)
}
}
}
OneWeatherWidget/UI/WidgetViews/HighLowTemperatureView.swift
0 → 100644
View file @
1d9efe87
//
// HighLowTemperatureView.swift
// OneWeatherWidgetExtension
//
// Created by Demid Merzlyakov on 01.07.2021.
//
import
SwiftUI
struct
HighLowTemperatureView
:
View
{
@State
public
var
highTemperature
:
String
@State
public
var
lowTemperature
:
String
var
body
:
some
View
{
HStack
{
Text
(
"H
\(
highTemperature
)
"
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
foregroundColor
(
Color
(
"HighLowTemperatureColor"
))
Text
(
"L
\(
lowTemperature
)
"
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
foregroundColor
(
Color
(
"HighLowTemperatureColor"
))
}
}
}
OneWeatherWidget/UI/
Small
WidgetView.swift
→
OneWeatherWidget/UI/
WidgetViews/SmallTemperature
WidgetView.swift
View file @
1d9efe87
...
@@ -9,9 +9,9 @@ import SwiftUI
...
@@ -9,9 +9,9 @@ import SwiftUI
import
WidgetKit
import
WidgetKit
import
OneWeatherCore
import
OneWeatherCore
struct
SmallWidgetView
:
View
{
struct
Small
Temperature
WidgetView
:
View
{
//Public
//Public
let
widgetViewModel
:
Small
WidgetViewModel
let
widgetViewModel
:
Forecast
WidgetViewModel
//Private
//Private
@Environment(\.colorScheme)
private
var
colorScheme
@Environment(\.colorScheme)
private
var
colorScheme
...
@@ -29,17 +29,8 @@ struct SmallWidgetView: View {
...
@@ -29,17 +29,8 @@ struct SmallWidgetView: View {
GeometryReader
{
geometry
in
GeometryReader
{
geometry
in
VStack
{
VStack
{
HStack
(
spacing
:
4
)
{
HStack
(
spacing
:
4
)
{
Text
(
widgetViewModel
.
cityName
)
CityNameView
(
cityName
:
widgetViewModel
.
cityName
,
.
multilineTextAlignment
(
.
leading
)
isDeviceLocation
:
widgetViewModel
.
isDeviceLocation
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
foregroundColor
(
ThemeManager
.
currentTheme
.
graphTintColor
.
color
)
Image
(
"location_arrow"
)
.
resizable
()
.
renderingMode
(
.
template
)
.
frame
(
width
:
8
,
height
:
8
,
alignment
:
.
center
)
.
aspectRatio
(
contentMode
:
.
fit
)
.
foregroundColor
(
Color
(
ThemeManager
.
currentTheme
.
graphTintColor
.
cgColor
))
.
opacity
(
widgetViewModel
.
isDeviceLocation
?
1
:
0
)
Spacer
()
Spacer
()
}
}
.
padding
(
.
top
,
12
)
.
padding
(
.
top
,
12
)
...
@@ -51,12 +42,12 @@ struct SmallWidgetView: View {
...
@@ -51,12 +42,12 @@ struct SmallWidgetView: View {
.
font
(
AppFont
.
SFProDisplay
.
light
(
size
:
32
)
.
font
)
.
font
(
AppFont
.
SFProDisplay
.
light
(
size
:
32
)
.
font
)
.
padding
(
.
leading
,
10
)
.
padding
(
.
leading
,
10
)
.
padding
(
.
trailing
,
4
)
.
padding
(
.
trailing
,
4
)
.
textColor
(
for
:
interfaceStyl
e
)
.
textColor
(
for
:
colorSchem
e
)
Text
(
widgetViewModel
.
weatherType
)
Text
(
widgetViewModel
.
weatherType
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
padding
(
.
leading
,
10
)
.
padding
(
.
leading
,
10
)
.
padding
(
.
trailing
,
4
)
.
padding
(
.
trailing
,
4
)
.
textColor
(
for
:
interfaceStyl
e
)
.
textColor
(
for
:
colorSchem
e
)
Spacer
(
minLength
:
0
)
Spacer
(
minLength
:
0
)
}
}
.
frame
(
height
:
70
)
.
frame
(
height
:
70
)
...
@@ -66,20 +57,15 @@ struct SmallWidgetView: View {
...
@@ -66,20 +57,15 @@ struct SmallWidgetView: View {
.
resizable
()
.
resizable
()
.
aspectRatio
(
contentMode
:
.
fit
)
.
aspectRatio
(
contentMode
:
.
fit
)
.
frame
(
width
:
70
,
height
:
70
,
alignment
:
.
center
)
.
frame
(
width
:
70
,
height
:
70
,
alignment
:
.
center
)
.
shadow
(
for
:
interfaceStyl
e
)
.
shadow
(
for
:
colorSchem
e
)
.
padding
(
.
trailing
,
4
)
.
padding
(
.
trailing
,
4
)
}
}
HStack
{
HStack
{
Text
(
"H
\(
widgetViewModel
.
highTemperature
)
"
)
HighLowTemperatureView
(
highTemperature
:
widgetViewModel
.
highTemperature
,
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
lowTemperature
:
widgetViewModel
.
lowTemperature
)
.
footerTextColor
(
for
:
interfaceStyle
)
Text
(
"L
\(
widgetViewModel
.
lowTemperature
)
"
)
.
font
(
AppFont
.
SFProDisplay
.
regular
(
size
:
12
)
.
font
)
.
footerTextColor
(
for
:
interfaceStyle
)
Spacer
()
Spacer
()
}
}
// .padding(.top, 20)
.
padding
(
.
bottom
,
21
)
.
padding
(
.
bottom
,
21
)
.
padding
(
.
leading
,
10
)
.
padding
(
.
leading
,
10
)
}
}
...
@@ -89,38 +75,33 @@ struct SmallWidgetView: View {
...
@@ -89,38 +75,33 @@ struct SmallWidgetView: View {
//MARK: Appearence extension
//MARK: Appearence extension
private
extension
View
{
private
extension
View
{
func
shadow
(
for
interfaceStyle
:
AppInterfaceStyl
e
)
->
some
View
{
func
shadow
(
for
colorScheme
:
ColorSchem
e
)
->
some
View
{
switch
interfaceStyl
e
{
switch
colorSchem
e
{
case
.
light
:
case
.
light
:
return
self
.
shadow
(
color
:
Color
.
black
.
opacity
(
0.5
),
radius
:
16
,
x
:
2
,
y
:
0
)
return
self
.
shadow
(
color
:
Color
.
black
.
opacity
(
0.5
),
radius
:
16
,
x
:
2
,
y
:
0
)
case
.
dark
:
case
.
dark
:
return
self
.
shadow
(
color
:
Color
.
white
.
opacity
(
0.24
),
radius
:
16
,
x
:
2
,
y
:
0
)
return
self
.
shadow
(
color
:
Color
.
white
.
opacity
(
0.24
),
radius
:
16
,
x
:
2
,
y
:
0
)
@unknown
default
:
return
self
.
shadow
(
color
:
Color
.
black
.
opacity
(
0.5
),
radius
:
16
,
x
:
2
,
y
:
0
)
}
}
}
}
func
textColor
(
for
interfaceStyle
:
AppInterfaceStyl
e
)
->
some
View
{
func
textColor
(
for
colorScheme
:
ColorSchem
e
)
->
some
View
{
switch
interfaceStyl
e
{
switch
colorSchem
e
{
case
.
light
:
case
.
light
:
return
self
.
foregroundColor
(
ThemeManager
.
currentTheme
.
secondaryTextColor
.
color
)
return
self
.
foregroundColor
(
ThemeManager
.
currentTheme
.
secondaryTextColor
.
color
)
case
.
dark
:
case
.
dark
:
return
self
.
foregroundColor
(
ThemeManager
.
currentTheme
.
primaryTextColor
.
color
)
return
self
.
foregroundColor
(
ThemeManager
.
currentTheme
.
primaryTextColor
.
color
)
}
@unknown
default
:
}
return
self
.
foregroundColor
(
ThemeManager
.
currentTheme
.
secondaryTextColor
.
color
)
func
footerTextColor
(
for
interfaceStyle
:
AppInterfaceStyle
)
->
some
View
{
switch
interfaceStyle
{
case
.
light
:
return
self
.
foregroundColor
(
UIColor
(
hex
:
0xA6ACbe
)
.
color
)
case
.
dark
:
return
self
.
foregroundColor
(
UIColor
(
hex
:
0xA9BAC5
)
.
color
)
}
}
}
}
}
}
struct
Small
Widget
_Preview
:
PreviewProvider
{
struct
Small
TemperatureWidgetView
_Preview
:
PreviewProvider
{
static
var
previews
:
some
View
{
static
var
previews
:
some
View
{
SmallWidgetView
(
widgetViewModel
:
.
init
(
location
:
WeatherEntry
.
defaultLocation
))
Small
Temperature
WidgetView
(
widgetViewModel
:
.
init
(
location
:
WeatherEntry
.
defaultLocation
))
.
previewContext
(
WidgetPreviewContext
(
family
:
.
systemSmall
))
.
previewContext
(
WidgetPreviewContext
(
family
:
.
systemSmall
))
}
}
}
}
OneWeatherWidget/ViewModels/
Small
WidgetViewModel.swift
→
OneWeatherWidget/ViewModels/
Forecast
WidgetViewModel.swift
View file @
1d9efe87
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
import
SwiftUI
import
SwiftUI
import
OneWeatherCore
import
OneWeatherCore
struct
Small
WidgetViewModel
{
struct
Forecast
WidgetViewModel
{
let
cityName
:
String
let
cityName
:
String
let
temperature
:
String
let
temperature
:
String
let
weatherType
:
String
let
weatherType
:
String
...
@@ -17,7 +17,7 @@ struct SmallWidgetViewModel {
...
@@ -17,7 +17,7 @@ struct SmallWidgetViewModel {
let
lowTemperature
:
String
let
lowTemperature
:
String
let
isDeviceLocation
:
Bool
let
isDeviceLocation
:
Bool
init
(
location
:
Location
)
{
init
(
location
:
Location
)
{
self
.
cityName
=
location
.
cityName
??
"--"
self
.
cityName
=
location
.
cityName
??
"--"
self
.
temperature
=
"
\(
location
.
today
?
.
temp
?
.
shortString
??
"--"
)
"
self
.
temperature
=
"
\(
location
.
today
?
.
temp
?
.
shortString
??
"--"
)
"
self
.
weatherType
=
location
.
today
?
.
type
.
localized
(
isDay
:
location
.
today
?
.
isDay
??
true
)
??
"--"
self
.
weatherType
=
location
.
today
?
.
type
.
localized
(
isDay
:
location
.
today
?
.
isDay
??
true
)
??
"--"
...
...
OneWeatherWidget/
OneWeather
Widget.swift
→
OneWeatherWidget/
Widgets/SmallTemperature
Widget.swift
View file @
1d9efe87
...
@@ -8,14 +8,13 @@
...
@@ -8,14 +8,13 @@
import
WidgetKit
import
WidgetKit
import
SwiftUI
import
SwiftUI
@main
struct
SmallTemperatureWidget
:
Widget
{
struct
OneWeatherWidget
:
Widget
{
private
let
kind
=
"com.onelouder.oneweather.widget.small"
private
let
kind
=
"com.onelouder.oneweather.widget"
var
body
:
some
WidgetConfiguration
{
var
body
:
some
WidgetConfiguration
{
// We currently display selectedLocation, so it's not really configurable, but we'll probably need to switch to an IntentConfiguration at some point.
// We currently display selectedLocation, so it's not really configurable, but we'll probably need to switch to an IntentConfiguration at some point.
StaticConfiguration
(
kind
:
kind
,
provider
:
WeatherProvider
())
{
weatherEntry
in
StaticConfiguration
(
kind
:
kind
,
provider
:
WeatherProvider
())
{
weatherEntry
in
SmallWidgetView
(
widgetViewModel
:
.
init
(
location
:
weatherEntry
.
location
))
Small
Temperature
WidgetView
(
widgetViewModel
:
.
init
(
location
:
weatherEntry
.
location
))
}
}
.
supportedFamilies
([
.
systemSmall
])
.
supportedFamilies
([
.
systemSmall
])
}
}
...
...
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