Commit 3cc5019d by Dmitriy Stepanets

Working on line rendering in MediumWidget

parent c10cea72
...@@ -2083,7 +2083,7 @@ ...@@ -2083,7 +2083,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = 1Weather/1Weather.entitlements; CODE_SIGN_ENTITLEMENTS = 1Weather/1Weather.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = SET_BY_BUILD_SCRIPT; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 24W4XMQ38L; DEVELOPMENT_TEAM = 24W4XMQ38L;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
...@@ -2114,7 +2114,7 @@ ...@@ -2114,7 +2114,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = 1Weather/1Weather.entitlements; CODE_SIGN_ENTITLEMENTS = 1Weather/1Weather.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = SET_BY_BUILD_SCRIPT; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 24W4XMQ38L; DEVELOPMENT_TEAM = 24W4XMQ38L;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
...@@ -2188,7 +2188,7 @@ ...@@ -2188,7 +2188,7 @@
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = OneWeatherNotificationServiceExtension/OneWeatherNotificationServiceExtension.entitlements; CODE_SIGN_ENTITLEMENTS = OneWeatherNotificationServiceExtension/OneWeatherNotificationServiceExtension.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = SET_BY_BUILD_SCRIPT; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 24W4XMQ38L; DEVELOPMENT_TEAM = 24W4XMQ38L;
INFOPLIST_FILE = OneWeatherNotificationServiceExtension/Info.plist; INFOPLIST_FILE = OneWeatherNotificationServiceExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.4; IPHONEOS_DEPLOYMENT_TARGET = 14.4;
...@@ -2212,7 +2212,7 @@ ...@@ -2212,7 +2212,7 @@
buildSettings = { buildSettings = {
CODE_SIGN_ENTITLEMENTS = OneWeatherNotificationServiceExtension/OneWeatherNotificationServiceExtension.entitlements; CODE_SIGN_ENTITLEMENTS = OneWeatherNotificationServiceExtension/OneWeatherNotificationServiceExtension.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = SET_BY_BUILD_SCRIPT; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 24W4XMQ38L; DEVELOPMENT_TEAM = 24W4XMQ38L;
INFOPLIST_FILE = OneWeatherNotificationServiceExtension/Info.plist; INFOPLIST_FILE = OneWeatherNotificationServiceExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.4; IPHONEOS_DEPLOYMENT_TARGET = 14.4;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>1</string>
<key>GADApplicationIdentifier</key> <key>GADApplicationIdentifier</key>
<string>ca-app-pub-7118865896152167~5937109115</string> <string>ca-app-pub-7118865896152167~5937109115</string>
<key>GADNativeAdValidatorEnabled</key> <key>GADNativeAdValidatorEnabled</key>
......
...@@ -175,7 +175,7 @@ private extension WidgetPromotionController { ...@@ -175,7 +175,7 @@ private extension WidgetPromotionController {
stackView.spacing = 0 stackView.spacing = 0
stackView.addArrangedSubview(PromotionHeaderView()) stackView.addArrangedSubview(PromotionHeaderView())
stackView.addArrangedSubview(PromotionSmallWidgetView()) stackView.addArrangedSubview(PromotionSmallWidgetView())
stackView.addArrangedSubview(PromotionMediumWidgetView()) // stackView.addArrangedSubview(PromotionMediumWidgetView())
scrollView.addSubview(stackView) scrollView.addSubview(stackView)
stackView.snp.makeConstraints { make in stackView.snp.makeConstraints { make in
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>1</string>
<key>NSExtension</key> <key>NSExtension</key>
<dict> <dict>
<key>NSExtensionPointIdentifier</key> <key>NSExtensionPointIdentifier</key>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
CD259C07268DE109008D205E /* OneWeatherUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD259C06268DE109008D205E /* OneWeatherUITests.swift */; }; CD259C07268DE109008D205E /* OneWeatherUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD259C06268DE109008D205E /* OneWeatherUITests.swift */; };
CD259C09268DE109008D205E /* OneWeatherUI.h in Headers */ = {isa = PBXBuildFile; fileRef = CD259BFB268DE109008D205E /* OneWeatherUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; CD259C09268DE109008D205E /* OneWeatherUI.h in Headers */ = {isa = PBXBuildFile; fileRef = CD259BFB268DE109008D205E /* OneWeatherUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
CD3C83C326933ABD0087A225 /* MediumTemperatureWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3C83C226933ABC0087A225 /* MediumTemperatureWidgetView.swift */; }; CD3C83C326933ABD0087A225 /* MediumTemperatureWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3C83C226933ABC0087A225 /* MediumTemperatureWidgetView.swift */; };
CD4B95F6269494DA0061961F /* LineShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4B95F5269494DA0061961F /* LineShape.swift */; };
CD7D3161268EEF49000D01FA /* CityNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D315F268EEF48000D01FA /* CityNameView.swift */; }; CD7D3161268EEF49000D01FA /* CityNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D315F268EEF48000D01FA /* CityNameView.swift */; };
CD7D3162268EEF49000D01FA /* HighLowTemperatureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3160268EEF49000D01FA /* HighLowTemperatureView.swift */; }; CD7D3162268EEF49000D01FA /* HighLowTemperatureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3160268EEF49000D01FA /* HighLowTemperatureView.swift */; };
CD7D3164268EEF56000D01FA /* SmallTemperatureWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3163268EEF56000D01FA /* SmallTemperatureWidgetView.swift */; }; CD7D3164268EEF56000D01FA /* SmallTemperatureWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3163268EEF56000D01FA /* SmallTemperatureWidgetView.swift */; };
...@@ -26,6 +27,8 @@ ...@@ -26,6 +27,8 @@
CD7D3180268F04DD000D01FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD7D316C268EF219000D01FA /* Assets.xcassets */; }; CD7D3180268F04DD000D01FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD7D316C268EF219000D01FA /* Assets.xcassets */; };
CD7D3182268F0C60000D01FA /* OneWeatherUI+Global.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3181268F0C60000D01FA /* OneWeatherUI+Global.swift */; }; CD7D3182268F0C60000D01FA /* OneWeatherUI+Global.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3181268F0C60000D01FA /* OneWeatherUI+Global.swift */; };
CD7D3187268F1F2E000D01FA /* UIImage+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3186268F1F2E000D01FA /* UIImage+Resize.swift */; }; CD7D3187268F1F2E000D01FA /* UIImage+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7D3186268F1F2E000D01FA /* UIImage+Resize.swift */; };
CDC3F85A26946D0700AAE3BF /* HourlyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC3F85926946D0700AAE3BF /* HourlyView.swift */; };
CDC3F85C269471C900AAE3BF /* SF-Pro-Display-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = CDC3F85B269471C900AAE3BF /* SF-Pro-Display-Bold.otf */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
...@@ -49,6 +52,7 @@ ...@@ -49,6 +52,7 @@
CD259C06268DE109008D205E /* OneWeatherUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneWeatherUITests.swift; sourceTree = "<group>"; }; CD259C06268DE109008D205E /* OneWeatherUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneWeatherUITests.swift; sourceTree = "<group>"; };
CD259C08268DE109008D205E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; CD259C08268DE109008D205E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CD3C83C226933ABC0087A225 /* MediumTemperatureWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediumTemperatureWidgetView.swift; sourceTree = "<group>"; }; CD3C83C226933ABC0087A225 /* MediumTemperatureWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediumTemperatureWidgetView.swift; sourceTree = "<group>"; };
CD4B95F5269494DA0061961F /* LineShape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineShape.swift; sourceTree = "<group>"; };
CD7D315F268EEF48000D01FA /* CityNameView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CityNameView.swift; sourceTree = "<group>"; }; CD7D315F268EEF48000D01FA /* CityNameView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CityNameView.swift; sourceTree = "<group>"; };
CD7D3160268EEF49000D01FA /* HighLowTemperatureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HighLowTemperatureView.swift; sourceTree = "<group>"; }; CD7D3160268EEF49000D01FA /* HighLowTemperatureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HighLowTemperatureView.swift; sourceTree = "<group>"; };
CD7D3163268EEF56000D01FA /* SmallTemperatureWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SmallTemperatureWidgetView.swift; sourceTree = "<group>"; }; CD7D3163268EEF56000D01FA /* SmallTemperatureWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SmallTemperatureWidgetView.swift; sourceTree = "<group>"; };
...@@ -65,6 +69,8 @@ ...@@ -65,6 +69,8 @@
CD7D317E268F00EF000D01FA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; CD7D317E268F00EF000D01FA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
CD7D3181268F0C60000D01FA /* OneWeatherUI+Global.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OneWeatherUI+Global.swift"; sourceTree = "<group>"; }; CD7D3181268F0C60000D01FA /* OneWeatherUI+Global.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OneWeatherUI+Global.swift"; sourceTree = "<group>"; };
CD7D3186268F1F2E000D01FA /* UIImage+Resize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Resize.swift"; sourceTree = "<group>"; }; CD7D3186268F1F2E000D01FA /* UIImage+Resize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Resize.swift"; sourceTree = "<group>"; };
CDC3F85926946D0700AAE3BF /* HourlyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HourlyView.swift; sourceTree = "<group>"; };
CDC3F85B269471C900AAE3BF /* SF-Pro-Display-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Pro-Display-Bold.otf"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -158,6 +164,8 @@ ...@@ -158,6 +164,8 @@
children = ( children = (
CD7D3160268EEF49000D01FA /* HighLowTemperatureView.swift */, CD7D3160268EEF49000D01FA /* HighLowTemperatureView.swift */,
CD7D315F268EEF48000D01FA /* CityNameView.swift */, CD7D315F268EEF48000D01FA /* CityNameView.swift */,
CDC3F85926946D0700AAE3BF /* HourlyView.swift */,
CD4B95F5269494DA0061961F /* LineShape.swift */,
); );
path = SharedViews; path = SharedViews;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -178,6 +186,7 @@ ...@@ -178,6 +186,7 @@
children = ( children = (
CD7D3171268EF81B000D01FA /* SF-Pro-Display-Regular.otf */, CD7D3171268EF81B000D01FA /* SF-Pro-Display-Regular.otf */,
CD7D3172268EF81C000D01FA /* SF-Pro-Display-Light.otf */, CD7D3172268EF81C000D01FA /* SF-Pro-Display-Light.otf */,
CDC3F85B269471C900AAE3BF /* SF-Pro-Display-Bold.otf */,
); );
path = Fonts; path = Fonts;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -287,6 +296,7 @@ ...@@ -287,6 +296,7 @@
files = ( files = (
CD7D3180268F04DD000D01FA /* Assets.xcassets in Resources */, CD7D3180268F04DD000D01FA /* Assets.xcassets in Resources */,
CD7D3174268EF81C000D01FA /* SF-Pro-Display-Light.otf in Resources */, CD7D3174268EF81C000D01FA /* SF-Pro-Display-Light.otf in Resources */,
CDC3F85C269471C900AAE3BF /* SF-Pro-Display-Bold.otf in Resources */,
CD7D3173268EF81C000D01FA /* SF-Pro-Display-Regular.otf in Resources */, CD7D3173268EF81C000D01FA /* SF-Pro-Display-Regular.otf in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -331,6 +341,7 @@ ...@@ -331,6 +341,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
CD7D3162268EEF49000D01FA /* HighLowTemperatureView.swift in Sources */, CD7D3162268EEF49000D01FA /* HighLowTemperatureView.swift in Sources */,
CD4B95F6269494DA0061961F /* LineShape.swift in Sources */,
CD7D3161268EEF49000D01FA /* CityNameView.swift in Sources */, CD7D3161268EEF49000D01FA /* CityNameView.swift in Sources */,
CD7D3164268EEF56000D01FA /* SmallTemperatureWidgetView.swift in Sources */, CD7D3164268EEF56000D01FA /* SmallTemperatureWidgetView.swift in Sources */,
CD3C83C326933ABD0087A225 /* MediumTemperatureWidgetView.swift in Sources */, CD3C83C326933ABD0087A225 /* MediumTemperatureWidgetView.swift in Sources */,
...@@ -339,6 +350,7 @@ ...@@ -339,6 +350,7 @@
CD7D3178268EFB9E000D01FA /* WidgetViewModelMock.swift in Sources */, CD7D3178268EFB9E000D01FA /* WidgetViewModelMock.swift in Sources */,
CD7D316F268EF2BC000D01FA /* WidgetViewModel.swift in Sources */, CD7D316F268EF2BC000D01FA /* WidgetViewModel.swift in Sources */,
CD7D3182268F0C60000D01FA /* OneWeatherUI+Global.swift in Sources */, CD7D3182268F0C60000D01FA /* OneWeatherUI+Global.swift in Sources */,
CDC3F85A26946D0700AAE3BF /* HourlyView.swift in Sources */,
CD7D3176268EF8A9000D01FA /* WidgetFont.swift in Sources */, CD7D3176268EF8A9000D01FA /* WidgetFont.swift in Sources */,
CD7D3169268EF167000D01FA /* UIColor+Color.swift in Sources */, CD7D3169268EF167000D01FA /* UIColor+Color.swift in Sources */,
); );
...@@ -498,7 +510,7 @@ ...@@ -498,7 +510,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = OneWeatherUI/Info.plist; INFOPLIST_FILE = OneWeatherUI/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.4; IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
...@@ -527,7 +539,7 @@ ...@@ -527,7 +539,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = OneWeatherUI/Info.plist; INFOPLIST_FILE = OneWeatherUI/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.4; IPHONEOS_DEPLOYMENT_TARGET = 14.1;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
......
{
"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" : "43",
"green" : "38",
"red" : "38"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"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" : "58",
"green" : "56",
"red" : "56"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.640",
"blue" : "244",
"green" : "230",
"red" : "229"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.650",
"blue" : "0",
"green" : "0",
"red" : "0"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.080",
"blue" : "106",
"green" : "106",
"red" : "106"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"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" : "26",
"green" : "23",
"red" : "23"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -5,10 +5,40 @@ ...@@ -5,10 +5,40 @@
// Created by Dmitry Stepanets on 02.07.2021. // Created by Dmitry Stepanets on 02.07.2021.
// //
import Foundation import UIKit
struct OneWeatherUI {} struct OneWeatherUI {}
extension OneWeatherUI { extension OneWeatherUI {
private class OneWeatherUIClass {} private class OneWeatherUIClass {}
static let frameworkBundle = Bundle(for: OneWeatherUIClass.self) static let frameworkBundle = Bundle(for: OneWeatherUIClass.self)
static let loadFonts: () = {
loadFontWith(name: "SF-Pro-Display-Regular", fileExtension: "otf")
loadFontWith(name: "SF-Pro-Display-Light", fileExtension: "otf")
loadFontWith(name: "SF-Pro-Display-Bold", fileExtension: "otf")
}()
internal static func loadFontWith(name: String, fileExtension: String) {
guard let pathForResource = OneWeatherUI.frameworkBundle.path(forResource: name, ofType: fileExtension) else {
print("[OneWeatherUI] Failed to load font \(name).\(fileExtension)")
return
}
guard let fontData = NSData(contentsOfFile: pathForResource) else {
print("[OneWeatherUI] Invalid font data")
return
}
guard let dataProvider = CGDataProvider(data: fontData) else {
print("[OneWeatherUI] Invalid font data")
return
}
guard let fontRef = CGFont(dataProvider) else {
print("[OneWeatherUI] Invalid CGFont reference")
return
}
var errorRef: Unmanaged<CFError>? = nil
if CTFontManagerRegisterGraphicsFont(fontRef, &errorRef) == false {
print("[OneWeatherUI] Failed to register font, this font may have already been registered in the main bundle.")
}
}
} }
...@@ -13,33 +13,4 @@ public extension UIFont { ...@@ -13,33 +13,4 @@ public extension UIFont {
var font: Font { var font: Font {
return Font(self) return Font(self)
} }
internal static func loadFontWith(name: String, fileExtension: String) {
guard let pathForResource = OneWeatherUI.frameworkBundle.path(forResource: name, ofType: fileExtension) else {
print("[OneWeatherUI] Failed to load font \(name).\(fileExtension)")
return
}
guard let fontData = NSData(contentsOfFile: pathForResource) else {
print("[OneWeatherUI] Invalid font data")
return
}
guard let dataProvider = CGDataProvider(data: fontData) else {
print("[OneWeatherUI] Invalid font data")
return
}
guard let fontRef = CGFont(dataProvider) else {
print("[OneWeatherUI] Invalid CGFont reference")
return
}
var errorRef: Unmanaged<CFError>? = nil
if CTFontManagerRegisterGraphicsFont(fontRef, &errorRef) == false {
print("[OneWeatherUI] Failed to register font, this font may have already been registered in the main bundle.")
}
}
static let loadOneWeatherUI: () = {
loadFontWith(name: "SF-Pro-Display-Regular", fileExtension: "otf")
loadFontWith(name: "SF-Pro-Display-Light", fileExtension: "otf")
}()
} }
...@@ -66,10 +66,28 @@ public struct MediumTemperatureWidgetView: View { ...@@ -66,10 +66,28 @@ public struct MediumTemperatureWidgetView: View {
.font(WidgetFont.SFProDisplay.regular(size: 9).font) .font(WidgetFont.SFProDisplay.regular(size: 9).font)
} }
} }
Spacer()
// TODO: implement ZStack {
HStack(alignment: .center, spacing: 10) {
Spacer()
HourlyView()
HourlyView()
HourlyView()
HourlyView()
Spacer()
}
LineShape(lineHeight: 30)
.stroke(Color.red,
style: .init(lineWidth: 3,
lineCap: .round,
lineJoin: .round))
.background(Color(white: 1, opacity: 0.3))
.frame(height: 30)
}
} }
.padding([.leading, .trailing], 10) .padding([.leading, .trailing], 10)
.background(Color("PrimaryBackground",
bundle: OneWeatherUI.frameworkBundle))
} }
} }
} }
...@@ -96,6 +114,7 @@ private extension View { ...@@ -96,6 +114,7 @@ private extension View {
public struct MediumTemperatureWidgetView_Preview: PreviewProvider { public struct MediumTemperatureWidgetView_Preview: PreviewProvider {
public static var previews: some View { public static var previews: some View {
MediumTemperatureWidgetView(widgetViewModel: WidgetViewModelMock()) MediumTemperatureWidgetView(widgetViewModel: WidgetViewModelMock())
.preferredColorScheme(.dark)
.frame(width: 338, height: 158) .frame(width: 338, height: 158)
} }
} }
//
// HourlyView.swift
// OneWeatherUI
//
// Created by Dmitry Stepanets on 06.07.2021.
//
import SwiftUI
@available(iOS 14, *)
struct HourlyView: View {
//Private
@Environment(\.colorScheme) private var colorScheme
init() {
OneWeatherUI.loadFonts
}
var body: some View {
VStack {
Text("25")
.foregroundColor(Color("PrimaryTextColor",
bundle: OneWeatherUI.frameworkBundle))
.font(WidgetFont.SFProDisplay.bold(size: 16).font)
.padding(.top, 8)
Spacer()
Text("NOW")
.foregroundColor(Color("PrimaryTextColor",
bundle: OneWeatherUI.frameworkBundle))
.font(WidgetFont.SFProDisplay.bold(size: 12).font)
.padding(.bottom, 8)
}
.frame(minWidth: 70)
.background(Color("HourlyContainerBackground",
bundle: OneWeatherUI.frameworkBundle))
.compositingGroup()
.cornerRadius(12)
.primaryShadow(for: colorScheme)
.secondaryShadow(for: colorScheme)
.overlay(
RoundedRectangle(cornerRadius: 12)
.stroke(Color("HourlyContainerBorder",
bundle: OneWeatherUI.frameworkBundle),
lineWidth: 1)
)
}
}
//MARK:- UI helpers
@available(iOS 14, *)
private extension View {
func primaryShadow(for colorScheme: ColorScheme) -> some View {
switch colorScheme {
case .light:
return self
.shadow(color: Color("HourlyContainerPrimaryShadow",
bundle: OneWeatherUI.frameworkBundle),
radius: 18, x: 5, y: 5)
case .dark:
return self
.shadow(color: Color("HourlyContainerPrimaryShadow",
bundle: OneWeatherUI.frameworkBundle),
radius: 5, x: 5, y: 5)
default:
fatalError("[OneWeatherUI] Unsopported color scheme")
}
}
func secondaryShadow(for colorScheme: ColorScheme) -> some View {
switch colorScheme {
case .light:
return self
.shadow(color: Color("HourlyContainerSecondaryShadow",
bundle: OneWeatherUI.frameworkBundle),
radius: 6, x: -4, y: -2)
case .dark:
return self
.shadow(color: Color("HourlyContainerSecondaryShadow",
bundle: OneWeatherUI.frameworkBundle),
radius: 6, x: -4, y: -2)
default:
fatalError("[OneWeatherUI] Unsopported color scheme")
}
}
}
//MARK:- Preview
@available(iOS 14, *)
struct HourlyView_Preview: PreviewProvider {
static var previews: some View {
HourlyView()
.frame(width: 70, height: 78)
}
}
//
// LineShape.swift
// OneWeatherUI
//
// Created by Dmitry Stepanets on 06.07.2021.
//
import SwiftUI
struct LineShape: Shape {
private let lineHeight: Int
private let temps = [20, 23, 15, 29]
init(lineHeight: Int) {
self.lineHeight = lineHeight
}
func path(in rect: CGRect) -> Path {
var line = Path()
line.move(to: CGPoint(x: rect.minX, y: CGFloat(lineHeight / 2)))
line.addLine(to: CGPoint(x: rect.maxX, y: CGFloat(lineHeight / 2)))
return line
}
}
...@@ -9,15 +9,6 @@ import UIKit ...@@ -9,15 +9,6 @@ import UIKit
@available(iOS 14, *) @available(iOS 14, *)
struct WidgetFont { struct WidgetFont {
private static var fontsLoaded = false
init() {
if !WidgetFont.fontsLoaded {
UIFont.loadOneWeatherUI
WidgetFont.fontsLoaded = true
}
}
private static func fontDescriptor(family: String, size:CGFloat, weight:UIFont.Weight) -> UIFontDescriptor { private static func fontDescriptor(family: String, size:CGFloat, weight:UIFont.Weight) -> UIFontDescriptor {
let traitsDict = [UIFontDescriptor.TraitKey.weight: weight] let traitsDict = [UIFontDescriptor.TraitKey.weight: weight]
let descriptor = UIFontDescriptor(fontAttributes: [UIFontDescriptor.AttributeName.size : size, let descriptor = UIFontDescriptor(fontAttributes: [UIFontDescriptor.AttributeName.size : size,
...@@ -49,5 +40,8 @@ struct WidgetFont { ...@@ -49,5 +40,8 @@ struct WidgetFont {
static func regular(size: CGFloat) -> UIFont { static func regular(size: CGFloat) -> UIFont {
font(weigth: .regular, size: size) font(weigth: .regular, size: size)
} }
static func bold(size: CGFloat) -> UIFont {
font(weigth: .bold, 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