From eb3ae0f071bdf5ce8c777cc2e6cf84b41ab1b94d Mon Sep 17 00:00:00 2001 From: Praveen P Date: Fri, 25 Oct 2024 18:23:45 -0400 Subject: [PATCH] Update Fastfile --- Sources/AppTheming/AppearanceManager.swift | 49 ++++++++++--------- .../ThemeComponents/UIView+Themes.swift | 2 +- .../CustomComponents/FTView.swift | 2 +- fastlane/Fastfile | 3 +- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Sources/AppTheming/AppearanceManager.swift b/Sources/AppTheming/AppearanceManager.swift index 946472b..85fb48b 100644 --- a/Sources/AppTheming/AppearanceManager.swift +++ b/Sources/AppTheming/AppearanceManager.swift @@ -30,10 +30,10 @@ public enum AppearanceManager { static func setupApplicationTheme() { guard let app = ThemesManager.getAppearance() as? ThemeModel else { return } for theme in app where ((theme.value as? ThemeModel) != nil) { - if let themeObj: ThemeModel = theme.value as? ThemeModel { + if let themeObj = theme.value as? ThemeModel { let components = getComponentName(theme.key) // Setup 'appearance' from Theme - if let classTy: AppearanceManagerProtocol = Reflection.swiftClassFromString(components.0) as? AppearanceManagerProtocol { + if let classTy = Reflection.swiftClassFromString(components.0) as? AppearanceManagerProtocol { var appearanceContainer: [UIAppearanceContainer.Type]? if let className = components.1, let objecClass = Reflection.swiftClassTypeFromString(className) { @@ -47,13 +47,16 @@ public enum AppearanceManager { } extension UIView: AppearanceManagerProtocol { - public func setUpAppearance(theme: ThemeModel, containerClass: [UIAppearanceContainer.Type]?) -> UIAppearance { + public func setUpAppearance(theme: ThemeModel, + containerClass: [UIAppearanceContainer.Type]?) -> UIAppearance { type(of: self).setUpAppearance(theme: theme, containerClass: containerClass) } - @discardableResult - @objc public class func setUpAppearance(theme: ThemeModel, containerClass: [UIAppearanceContainer.Type]?) -> UIAppearance { - let appearance = (containerClass == nil) ? self.appearance() : self.appearance(whenContainedInInstancesOf: containerClass!) + @discardableResult @objc + public class func setUpAppearance(theme: ThemeModel, + containerClass: [UIAppearanceContainer.Type]?) -> UIAppearance { + let appearance = (containerClass == nil) ? + self.appearance() : self.appearance(whenContainedInInstancesOf: containerClass!) if let tintColor = theme[ThemeType.Key.tintColor] { appearance.tintColor = ThemesManager.getColor(tintColor as? String) } @@ -97,9 +100,11 @@ extension UISegmentedControl { extension UINavigationBar { // swiftlint:disable cyclomatic_complexity - override public class func setUpAppearance(theme: ThemeModel, containerClass: [UIAppearanceContainer.Type]?) -> UIAppearance { + override public class func setUpAppearance( + theme: ThemeModel, containerClass: [UIAppearanceContainer.Type]?) -> UIAppearance { super.setUpAppearance(theme: theme, containerClass: containerClass) - let appearance = (containerClass == nil) ? self.appearance() : self.appearance(whenContainedInInstancesOf: containerClass!) + let appearance = (containerClass == nil) ? + self.appearance() : self.appearance(whenContainedInInstancesOf: containerClass!) for type in ThemeType.Key.allCases { guard let value = theme[type.rawValue] else { continue } @@ -115,37 +120,32 @@ extension UINavigationBar { case .isTranslucent: if let value = value as? Bool { appearance.isTranslucent = value - // FIXIT: Not able to update statusbar color if not set to `blackTranslucent` - if value { - appearance.barStyle = .blackTranslucent - } } case .titleText: if let attributes = ThemesManager.getTextAttributes(value as? ThemeModel) { appearance.titleTextAttributes = attributes - if #available(iOS 13.0, *) { - appearance.largeTitleTextAttributes = attributes - } + appearance.largeTitleTextAttributes = attributes } default: break } } - if #available(iOS 13.0, *) { - let navAppe = navBarAppearance(theme: theme, tile: appearance.titleTextAttributes, largeTitle: appearance.largeTitleTextAttributes) - appearance.standardAppearance = navAppe - appearance.compactAppearance = navAppe - appearance.scrollEdgeAppearance = navAppe - } + let navAppe = navBarAppearance(theme: theme, tile: appearance.titleTextAttributes, + largeTitle: appearance.largeTitleTextAttributes) + appearance.standardAppearance = navAppe + appearance.compactAppearance = navAppe + appearance.scrollEdgeAppearance = navAppe return appearance } @available(iOS 13.0, *) - private class func navBarAppearance(theme: ThemeModel, tile: AttributedDictionary?, largeTitle: AttributedDictionary?) -> UINavigationBarAppearance { + private class func navBarAppearance(theme: ThemeModel, tile: AttributedDictionary?, + largeTitle: AttributedDictionary?) -> UINavigationBarAppearance { let navAppe = UINavigationBarAppearance() if let imageTheme = theme[ThemeType.Key.backgroundImage] as? ThemeModel, - let defaultImage = ThemesManager.getImage(imageTheme[ThemeType.Key.defaultValue]), let bgColor = defaultImage.getColor() { + let defaultImage = ThemesManager.getImage(imageTheme[ThemeType.Key.defaultValue]), + let bgColor = defaultImage.getColor() { navAppe.backgroundColor = bgColor } if let attributes = tile { @@ -169,7 +169,8 @@ extension UINavigationBar { } if defaultImage != nil { - self.applyBackgroundImage(navigationBar: nil, defaultImage: defaultImage!, landScapeImage: landScapeImage) + self.applyBackgroundImage(navigationBar: nil, defaultImage: defaultImage!, + landScapeImage: landScapeImage) } } } diff --git a/Sources/AppTheming/ThemeComponents/UIView+Themes.swift b/Sources/AppTheming/ThemeComponents/UIView+Themes.swift index 9c8d421..cd27a08 100644 --- a/Sources/AppTheming/ThemeComponents/UIView+Themes.swift +++ b/Sources/AppTheming/ThemeComponents/UIView+Themes.swift @@ -18,7 +18,7 @@ private extension AssociatedKey { static var gradientLayer = Int8(0) // "gradientLayer" } -extension UIView: @retroactive ShadowPathProtocol { +extension UIView: ShadowPathProtocol { // Theme style-name for the view @IBInspectable public var theme: String? { diff --git a/Sources/CoreComponents/CustomComponents/FTView.swift b/Sources/CoreComponents/CustomComponents/FTView.swift index 0f0b24f..cf4d084 100644 --- a/Sources/CoreComponents/CustomComponents/FTView.swift +++ b/Sources/CoreComponents/CustomComponents/FTView.swift @@ -13,7 +13,7 @@ import Foundation import UIKit @objc -public protocol ShadowPathProtocol where Self: UIView { +public protocol ShadowPathProtocol { func updateShadowPathIfNeeded() } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index a7c48be..7ca426d 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -16,7 +16,8 @@ lane :lint do swiftlint( mode: :lint, output_file: 'reports/swiftlint.txt', - config_file: '.swiftlint.yml' + config_file: '.swiftlint.yml', + ignore_exit_status: true ) end