Commit d9f987f3 by Dmitriy Stepanets

Finished small widget layout

parent 066905ce
...@@ -66,6 +66,13 @@ ...@@ -66,6 +66,13 @@
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 */; };
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 */; };
CD483A952664D77700CA53AB /* SF-Pro.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CDD0F1E42572425200CF5017 /* SF-Pro.ttf */; };
CD483A982664DAB100CA53AB /* WidgetFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD483A972664DAB100CA53AB /* WidgetFont.swift */; };
CD483A9A2664DF7300CA53AB /* SF-Pro-Display-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = CD483A992664DF7300CA53AB /* SF-Pro-Display-Light.otf */; };
CD483A9B2664DF7300CA53AB /* SF-Pro-Display-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = CD483A992664DF7300CA53AB /* SF-Pro-Display-Light.otf */; };
CD483A9D2664E08200CA53AB /* 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 */; };
CD55E0BB2615EE2400CC4DC7 /* PollutantView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD55E0BA2615EE2400CC4DC7 /* PollutantView.swift */; }; CD55E0BB2615EE2400CC4DC7 /* PollutantView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD55E0BA2615EE2400CC4DC7 /* PollutantView.swift */; };
CD5692B42653D46200A3CDBE /* SplashAnimationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD5692B32653D46100A3CDBE /* SplashAnimationViewController.swift */; }; CD5692B42653D46200A3CDBE /* SplashAnimationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD5692B32653D46100A3CDBE /* SplashAnimationViewController.swift */; };
CD5692B62653D56700A3CDBE /* splash.json in Resources */ = {isa = PBXBuildFile; fileRef = CD5692B52653D56700A3CDBE /* splash.json */; }; CD5692B62653D56700A3CDBE /* splash.json in Resources */ = {isa = PBXBuildFile; fileRef = CD5692B52653D56700A3CDBE /* splash.json */; };
...@@ -330,6 +337,9 @@ ...@@ -330,6 +337,9 @@
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>"; };
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>"; };
CD483A972664DAB100CA53AB /* WidgetFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetFont.swift; 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>"; };
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>"; };
CD5692B32653D46100A3CDBE /* SplashAnimationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplashAnimationViewController.swift; sourceTree = "<group>"; }; CD5692B32653D46100A3CDBE /* SplashAnimationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SplashAnimationViewController.swift; sourceTree = "<group>"; };
CD5692B52653D56700A3CDBE /* splash.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash.json; sourceTree = "<group>"; }; CD5692B52653D56700A3CDBE /* splash.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash.json; sourceTree = "<group>"; };
...@@ -643,6 +653,7 @@ ...@@ -643,6 +653,7 @@
CD1B713F2660F95000916E71 /* OneWeatherWidget.swift */, CD1B713F2660F95000916E71 /* OneWeatherWidget.swift */,
CD1B71412660F95300916E71 /* Assets.xcassets */, CD1B71412660F95300916E71 /* Assets.xcassets */,
CD1B71432660F95300916E71 /* Info.plist */, CD1B71432660F95300916E71 /* Info.plist */,
CD483A972664DAB100CA53AB /* WidgetFont.swift */,
); );
path = OneWeatherWidget; path = OneWeatherWidget;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1033,6 +1044,8 @@ ...@@ -1033,6 +1044,8 @@
CDD0F1E3257240F300CF5017 /* Fonts */ = { CDD0F1E3257240F300CF5017 /* Fonts */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CD483A9C2664E08200CA53AB /* SF-Pro-Display-Regular.otf */,
CD483A992664DF7300CA53AB /* SF-Pro-Display-Light.otf */,
CDD0F1E42572425200CF5017 /* SF-Pro.ttf */, CDD0F1E42572425200CF5017 /* SF-Pro.ttf */,
); );
path = Fonts; path = Fonts;
...@@ -1420,6 +1433,7 @@ ...@@ -1420,6 +1433,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
CD483A9A2664DF7300CA53AB /* SF-Pro-Display-Light.otf in Resources */,
CDD0F1E52572425200CF5017 /* SF-Pro.ttf in Resources */, CDD0F1E52572425200CF5017 /* SF-Pro.ttf in Resources */,
CD5692B62653D56700A3CDBE /* splash.json in Resources */, CD5692B62653D56700A3CDBE /* splash.json in Resources */,
CDD75F0D25DE68B10099ACDB /* Localizable.strings in Resources */, CDD75F0D25DE68B10099ACDB /* Localizable.strings in Resources */,
...@@ -1432,6 +1446,7 @@ ...@@ -1432,6 +1446,7 @@
CE13B88E26248A77007CBD4D /* GoogleService-Info-Production.plist in Resources */, CE13B88E26248A77007CBD4D /* GoogleService-Info-Production.plist in Resources */,
CE13B810262480B3007CBD4D /* StoriesNativeAdCell.xib in Resources */, CE13B810262480B3007CBD4D /* StoriesNativeAdCell.xib in Resources */,
CD1237CC255D5C5C00C98139 /* Assets.xcassets in Resources */, CD1237CC255D5C5C00C98139 /* Assets.xcassets in Resources */,
CD483A9D2664E08200CA53AB /* SF-Pro-Display-Regular.otf in Resources */,
CD822FFA25D6890900A05501 /* OneWeatherColorsAsset.xcassets in Resources */, CD822FFA25D6890900A05501 /* OneWeatherColorsAsset.xcassets in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -1440,6 +1455,10 @@ ...@@ -1440,6 +1455,10 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
CD483A942664D64A00CA53AB /* Assets.xcassets in Resources */,
CD483A952664D77700CA53AB /* SF-Pro.ttf in Resources */,
CD483A9B2664DF7300CA53AB /* SF-Pro-Display-Light.otf in Resources */,
CD483A9E2664E08200CA53AB /* SF-Pro-Display-Regular.otf in Resources */,
CD1B71422660F95300916E71 /* Assets.xcassets in Resources */, CD1B71422660F95300916E71 /* Assets.xcassets in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -1786,6 +1805,7 @@ ...@@ -1786,6 +1805,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
CD483A982664DAB100CA53AB /* WidgetFont.swift in Sources */,
CD1B71402660F95000916E71 /* OneWeatherWidget.swift in Sources */, CD1B71402660F95000916E71 /* OneWeatherWidget.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key> <key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>51</integer> <integer>53</integer>
</dict> </dict>
<key>OneWeatherWidgetExtension.xcscheme_^#shared#^_</key> <key>OneWeatherWidgetExtension.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>55</integer> <integer>49</integer>
</dict> </dict>
<key>PG (Playground) 1.xcscheme</key> <key>PG (Playground) 1.xcscheme</key>
<dict> <dict>
......
...@@ -392,6 +392,8 @@ ...@@ -392,6 +392,8 @@
</array> </array>
<key>UIAppFonts</key> <key>UIAppFonts</key>
<array> <array>
<string>SF-Pro-Display-Light.otf</string>
<string>SF-Pro-Display-Regular.otf</string>
<string>SF-Pro.ttf</string> <string>SF-Pro.ttf</string>
</array> </array>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
......
...@@ -25,5 +25,11 @@ ...@@ -25,5 +25,11 @@
<key>NSExtensionPointIdentifier</key> <key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string> <string>com.apple.widgetkit-extension</string>
</dict> </dict>
<key>UIAppFonts</key>
<array>
<string>SF-Pro-Display-Regular.otf</string>
<string>SF-Pro-Display-Light.otf</string>
<string>SF-Pro.ttf</string>
</array>
</dict> </dict>
</plist> </plist>
...@@ -65,30 +65,50 @@ struct WidgetEntryView: View { ...@@ -65,30 +65,50 @@ struct WidgetEntryView: View {
var body: some View { var body: some View {
GeometryReader { geometry in GeometryReader { geometry in
VStack { VStack {
HStack { HStack(spacing: 4) {
Text("New York") Text("New York")
.font(.system(size: 12)) .multilineTextAlignment(.leading)
.padding(.init(top: 12, leading: 10, bottom: 0, trailing: 0)) .font(WidgetFont.SFProDisplay.regular(size: 12))
Image("location_arrow")
.resizable()
.frame(width: 8, height: 8, alignment: .center)
.foregroundColor(.blue)
Spacer() Spacer()
} }
HStack { .padding(.top, 12)
VStack(alignment: .leading, spacing: 0){ .padding(.leading, 10)
HStack(spacing: 0) {
VStack(alignment: .leading){
Text("96°") Text("96°")
.font(.system(size: 32)) .font(WidgetFont.SFProDisplay.light(size: 32))
.padding(.leading, 10) .padding(.leading, 10)
.padding(.top, 10)
Text("Partly Cloudy Cloudy") Text("Partly Cloudy Cloudy")
.font(.system(size: 12)) .font(WidgetFont.SFProDisplay.regular(size: 12))
.padding(.top, 2) .frame(width: geometry.size.width * 0.5, alignment: .leading)
.padding(.leading, 10) .padding(.leading, 10)
.frame(width: geometry.size.width * 0.6, alignment: .leading) Spacer(minLength: 0)
Text("H 97° L 89°")
.font(.system(size: 12))
.padding(.leading, 10)
.padding(.top, 20)
} }
.background(Color.yellow) .frame(height: 70)
Spacer(minLength: 0)
Image("freezingFog")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 70, height: 70, alignment: .center)
.shadow(color: Color.black.opacity(0.5), radius: 16, x: 2, y: 0)
.padding(.trailing, 4)
}
HStack {
Text("H 97°")
.font(WidgetFont.SFProDisplay.regular(size: 12))
Text("L 89°")
.font(WidgetFont.SFProDisplay.regular(size: 12))
Spacer()
} }
.padding(.top, 20)
.padding(.leading, 10)
} }
} }
} }
......
//
// WidgetFont.swift
// OneWeatherWidgetExtension
//
// Created by Dmitry Stepanets on 31.05.2021.
//
import SwiftUI
public struct WidgetFont {
public struct SFPro {
static func regular(size: CGFloat) -> Font {
Font.custom("SF Pro", size: size)
}
static func bold(size: CGFloat) -> Font {
Font.custom("SF Pro", size: size).weight(.bold)
}
static func medium(size:CGFloat) -> Font {
Font.custom("SF Pro", size: size).weight(.medium)
}
static func semibold(size: CGFloat) -> Font {
Font.custom("SF Pro", size: size).weight(.semibold)
}
}
public struct SFProDisplay {
static func regular(size: CGFloat) -> Font {
Font.custom("SF-Pro-Display-Regular", size: size)
}
static func light(size: CGFloat) -> Font {
Font.custom("SF-Pro-Display-Light", size: size)
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment