From dfc40a38cb20035366e51c2367e5d017d7f871cd Mon Sep 17 00:00:00 2001 From: Nicolas Frugoni Date: Thu, 28 Dec 2023 17:48:55 +0000 Subject: [PATCH 1/4] Update iOS deployment targets to 15.1 --- Backpack-Common.podspec | 2 +- Backpack-Fonts/Backpack-Fonts.podspec | 2 +- Backpack-SwiftUI.podspec | 2 +- Backpack.podspec | 2 +- Example/Backpack.xcodeproj/project.pbxproj | 16 ++++++++-------- Example/Podfile | 4 ++-- Example/Podfile.lock | 12 ++++++------ 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Backpack-Common.podspec b/Backpack-Common.podspec index 33564b231..4689b1ade 100644 --- a/Backpack-Common.podspec +++ b/Backpack-Common.podspec @@ -34,7 +34,7 @@ Pod::Spec.new do |s| s.ios.resource_bundle = { 'Icons' => 'Backpack-Common/Icons/Assets/*' } - s.ios.deployment_target = '14.0' + s.ios.deployment_target = '15.1' s.source_files = 'Backpack-Common/**/*.swift' s.exclude_files = 'Backpack-Common/Tests/**/*.swift' s.requires_arc = true diff --git a/Backpack-Fonts/Backpack-Fonts.podspec b/Backpack-Fonts/Backpack-Fonts.podspec index ba4c54f0f..ba8c50559 100644 --- a/Backpack-Fonts/Backpack-Fonts.podspec +++ b/Backpack-Fonts/Backpack-Fonts.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |spec| spec.author = { 'Backpack Design System' => 'backpack@skyscanner.net' } - spec.ios.deployment_target = '14.0' + spec.ios.deployment_target = '15.1' spec.source = { git: 'https://github.com/Skyscanner/backpack-ios.git', tag: spec.version.to_s } diff --git a/Backpack-SwiftUI.podspec b/Backpack-SwiftUI.podspec index 23019df2d..c28a6364f 100644 --- a/Backpack-SwiftUI.podspec +++ b/Backpack-SwiftUI.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.source = { git: 'https://github.com/Skyscanner/backpack-ios.git', tag: s.version.to_s } - s.ios.deployment_target = '14.0' + s.ios.deployment_target = '15.1' s.source_files = 'Backpack-SwiftUI/*/Classes/**/*.swift' s.dependency 'Backpack-Common' diff --git a/Backpack.podspec b/Backpack.podspec index f54299ae4..5be8011dc 100644 --- a/Backpack.podspec +++ b/Backpack.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.source = { git: 'https://github.com/Skyscanner/backpack-ios.git', tag: s.version.to_s } - s.ios.deployment_target = '14.0' + s.ios.deployment_target = '15.1' s.source_files = 'Backpack/Backpack.h', 'Backpack/Common.h', 'Backpack/*/Classes/**/*.{h,m,swift}' s.exclude_files = 'Backpack/Tests/**' s.public_header_files = 'Backpack/Backpack.h', 'Backpack/*/Classes/**/*.h' diff --git a/Example/Backpack.xcodeproj/project.pbxproj b/Example/Backpack.xcodeproj/project.pbxproj index 4c55e91fa..5eb2d24f3 100644 --- a/Example/Backpack.xcodeproj/project.pbxproj +++ b/Example/Backpack.xcodeproj/project.pbxproj @@ -1956,7 +1956,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_SWIFT3_OBJC_INFERENCE = Default; @@ -2004,7 +2004,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_SWIFT3_OBJC_INFERENCE = Default; @@ -2033,7 +2033,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = NO; INFOPLIST_FILE = "Backpack/Backpack-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 1.0; MODULE_NAME = ExampleApp; @@ -2067,7 +2067,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = NO; INFOPLIST_FILE = "Backpack/Backpack-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 1.0; MODULE_NAME = ExampleApp; @@ -2093,7 +2093,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Backpack Screenshot/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -2122,7 +2122,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Backpack Screenshot/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; @@ -2153,7 +2153,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Backpack NativeUITests/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -2187,7 +2187,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "Backpack NativeUITests/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; diff --git a/Example/Podfile b/Example/Podfile index 712d539fa..5bf9307a7 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,6 +1,6 @@ source 'https://cdn.cocoapods.org/' -platform :ios, '14.0' +platform :ios, '15.1' use_frameworks! ensure_bundler! '> 2.0' @@ -25,7 +25,7 @@ post_install do |installer| puts 'Removing static analyzer support' installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1' end if target.name == "FSCalendar" diff --git a/Example/Podfile.lock b/Example/Podfile.lock index ef5c5b069..92ff7d2ca 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -81,10 +81,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AppCenter: 87ef6eefd8ade4df59e88951288587429f3dd2a5 - Backpack: e5f5dca8cef64bd1626b21fee94e06a3dbef60ee - Backpack-Common: cd375986447ca5f60fda52609fd6e1eccecfdc45 - Backpack-Fonts: 89f9d18aeeb0f6fb026e301261d3af3ee6a8ec6d - Backpack-SwiftUI: f3a7d7bce777f1bfaf70dbfd9d6b7d101d0263ec + Backpack: 6ea2b8690a1ac4e10a1bc19c84e9106acdfe2c02 + Backpack-Common: 9a47d236de2f7fea7366f7a893423b8375ee7a39 + Backpack-Fonts: 8d10ac600d738cb7ae6e49fee969800c2db51f6b + Backpack-SwiftUI: f1d0e98dc0beb0f0a44178796aae6c407fb9d7d3 FloatingPanel: 3cee815e9ded75b632543fa73ab655a1ef941452 FSCalendar: 2d1d0d9398f12d439f55c1fe0f01525b151b8260 MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 @@ -93,6 +93,6 @@ SPEC CHECKSUMS: SwiftLint: 99f82d07b837b942dd563c668de129a03fc3fb52 TTTAttributedLabel: 8cffe8e127e4e82ff3af1e5386d4cd0ad000b656 -PODFILE CHECKSUM: 2bf9f0ac06a0705cb6f41d0ac9f14da7a4f5abce +PODFILE CHECKSUM: db90d722d21004d77a9d6cf29da110b644239024 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 From db0e3dabbacd4b1154a3d74939c57ecfdede2313 Mon Sep 17 00:00:00 2001 From: Nicolas Frugoni Date: Thu, 28 Dec 2023 18:06:45 +0000 Subject: [PATCH 2/4] Removing check for iOS versions less than 15 --- .../BackpackFloatingPanelController.swift | 8 ++--- Backpack/Color/Classes/Generated/BPKColor.m | 36 +++++++++---------- .../Backpack Screenshot/SnapshotHelper.swift | 24 ++++++------- .../TappableLinkLabelsViewController.swift | 8 +---- 4 files changed, 31 insertions(+), 45 deletions(-) diff --git a/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift b/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift index 3a06be2bd..1da829dbb 100644 --- a/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift +++ b/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift @@ -45,11 +45,9 @@ final class BPKFloatingPanelController: FloatingPanelController { } override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - if #available(iOS 13.0, *) { - if self.traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { - guard let bottomSection = bottomSectionViewController else { return } - addTopShadow(to: bottomSection) - } + if self.traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { + guard let bottomSection = bottomSectionViewController else { return } + addTopShadow(to: bottomSection) } } } diff --git a/Backpack/Color/Classes/Generated/BPKColor.m b/Backpack/Color/Classes/Generated/BPKColor.m index 1d62bb690..a39b50e52 100644 --- a/Backpack/Color/Classes/Generated/BPKColor.m +++ b/Backpack/Color/Classes/Generated/BPKColor.m @@ -551,27 +551,25 @@ + (NSString *)cacheKeyForColor:(UIColor *)color { + (UIColor *)dynamicColorWithLightVariant:(UIColor *)lightVariant darkVariant:(UIColor *)darkVariant { #if __BPK_DARK_MODE_SUPPORTED - if (@available(iOS 13.0, *)) { - NSString *cacheKey = [NSString stringWithFormat:@"%@_%@", [self cacheKeyForColor:lightVariant], [self cacheKeyForColor:darkVariant]]; - UIColor *potentialCacheHit = [[self dynamicColorsCache] objectForKey:cacheKey]; - - if (potentialCacheHit) { - return potentialCacheHit; - } - - UIColor *newDynamicColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) { - if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { - return darkVariant; - } else { - return lightVariant; - } - }]; - - [[self dynamicColorsCache] setObject:newDynamicColor forKey:cacheKey]; - return newDynamicColor; + NSString *cacheKey = [NSString stringWithFormat:@"%@_%@", [self cacheKeyForColor:lightVariant], [self cacheKeyForColor:darkVariant]]; + UIColor *potentialCacheHit = [[self dynamicColorsCache] objectForKey:cacheKey]; + + if (potentialCacheHit) { + return potentialCacheHit; } + + UIColor *newDynamicColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) { + if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { + return darkVariant; + } else { + return lightVariant; + } + }]; + + [[self dynamicColorsCache] setObject:newDynamicColor forKey:cacheKey]; + return newDynamicColor; #endif - return lightVariant; + return lightVariant; } @end diff --git a/Example/Backpack Screenshot/SnapshotHelper.swift b/Example/Backpack Screenshot/SnapshotHelper.swift index da9223d61..2d396ac59 100644 --- a/Example/Backpack Screenshot/SnapshotHelper.swift +++ b/Example/Backpack Screenshot/SnapshotHelper.swift @@ -195,20 +195,16 @@ open class Snapshot: NSObject { } class func fixLandscapeOrientation(image: UIImage) -> UIImage { - #if os(watchOS) - return image - #else - if #available(iOS 10.0, *) { - let format = UIGraphicsImageRendererFormat() - format.scale = image.scale - let renderer = UIGraphicsImageRenderer(size: image.size, format: format) - return renderer.image { context in - image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) - } - } else { - return image - } - #endif +#if os(watchOS) + return image +#else + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } +#endif } class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { diff --git a/Example/Backpack/UIKit/Components/Link/TappableLinkLabelsViewController.swift b/Example/Backpack/UIKit/Components/Link/TappableLinkLabelsViewController.swift index 24f14aeff..d2101fd6c 100644 --- a/Example/Backpack/UIKit/Components/Link/TappableLinkLabelsViewController.swift +++ b/Example/Backpack/UIKit/Components/Link/TappableLinkLabelsViewController.swift @@ -126,12 +126,6 @@ class TappableLinkLabelsViewController: UIViewController, BPKTappableLinkLabelDe } func isAlternateStyleWithLightMode() -> Bool { - #if swift(>=4.2) - if #available(iOS 13.0, *) { - return style == .alternate && traitCollection.userInterfaceStyle == .light - } - - #endif - return true + style == .alternate && traitCollection.userInterfaceStyle == .light } } From ae6aa27c9a306a97bd8add17025df6d3f9020b46 Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Fri, 29 Dec 2023 16:39:36 +0800 Subject: [PATCH 3/4] update lint script to show changes --- scripts/lint | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/lint b/scripts/lint index d7b84aa85..096c62135 100755 --- a/scripts/lint +++ b/scripts/lint @@ -3,6 +3,7 @@ function checkPristine() { if [ -n "$(git status --porcelain)" ]; then echo "$1" + echo "$(git status --porcelain)" exit 1 fi } From 5f9fd2b8921851ed7a3ad570218a7ad1b2737789 Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Fri, 29 Dec 2023 16:46:02 +0800 Subject: [PATCH 4/4] fix generated color file --- Backpack/Color/Classes/Generated/BPKColor.m | 36 +++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Backpack/Color/Classes/Generated/BPKColor.m b/Backpack/Color/Classes/Generated/BPKColor.m index a39b50e52..1d62bb690 100644 --- a/Backpack/Color/Classes/Generated/BPKColor.m +++ b/Backpack/Color/Classes/Generated/BPKColor.m @@ -551,25 +551,27 @@ + (NSString *)cacheKeyForColor:(UIColor *)color { + (UIColor *)dynamicColorWithLightVariant:(UIColor *)lightVariant darkVariant:(UIColor *)darkVariant { #if __BPK_DARK_MODE_SUPPORTED - NSString *cacheKey = [NSString stringWithFormat:@"%@_%@", [self cacheKeyForColor:lightVariant], [self cacheKeyForColor:darkVariant]]; - UIColor *potentialCacheHit = [[self dynamicColorsCache] objectForKey:cacheKey]; - - if (potentialCacheHit) { - return potentialCacheHit; - } - - UIColor *newDynamicColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) { - if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { - return darkVariant; - } else { - return lightVariant; + if (@available(iOS 13.0, *)) { + NSString *cacheKey = [NSString stringWithFormat:@"%@_%@", [self cacheKeyForColor:lightVariant], [self cacheKeyForColor:darkVariant]]; + UIColor *potentialCacheHit = [[self dynamicColorsCache] objectForKey:cacheKey]; + + if (potentialCacheHit) { + return potentialCacheHit; } - }]; - - [[self dynamicColorsCache] setObject:newDynamicColor forKey:cacheKey]; - return newDynamicColor; + + UIColor *newDynamicColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) { + if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { + return darkVariant; + } else { + return lightVariant; + } + }]; + + [[self dynamicColorsCache] setObject:newDynamicColor forKey:cacheKey]; + return newDynamicColor; + } #endif - return lightVariant; + return lightVariant; } @end