From 4bdec327535470c8d9765d190625b13e99b87db5 Mon Sep 17 00:00:00 2001 From: Amir Khorsandi Date: Mon, 4 Apr 2022 20:51:43 +0200 Subject: [PATCH] Bump minimum to 13.0 (#70) * Bump minimum iOS to 13 * remove min ios 10 --- CollectionViewPagingLayout.podspec | 6 ++-- .../project.pbxproj | 16 ++++----- .../CollectionViewPagingLayout.xcscheme | 2 +- .../CollectionViewPagingLayoutTests.xcscheme | 2 +- Lib/BlurEffectView.swift | 1 - Lib/Scale/ScaleTransformView.swift | 3 +- Lib/Stack/StackTransformView.swift | 3 +- Lib/SwiftUI/PagePadding.swift | 3 -- Lib/SwiftUI/PagingCollectionViewCell.swift | 35 +++++++------------ .../PagingCollectionViewController.swift | 6 ---- ...agingCollectionViewControllerBuilder.swift | 3 -- .../PagingCollectionViewModifierData.swift | 5 --- Lib/SwiftUI/ScalePageView.swift | 4 --- Lib/SwiftUI/SnapshotPageView.swift | 6 ---- Lib/SwiftUI/StackPageView.swift | 4 --- Lib/SwiftUI/TransformPageView.swift | 3 -- Lib/SwiftUI/TransformPageViewProtocol.swift | 5 --- Package.swift | 2 +- .../xcschemes/PagingLayoutSamples.xcscheme | 2 +- Samples/Podfile.lock | 10 +++--- 20 files changed, 34 insertions(+), 87 deletions(-) diff --git a/CollectionViewPagingLayout.podspec b/CollectionViewPagingLayout.podspec index 9de0e31..f081bb6 100644 --- a/CollectionViewPagingLayout.podspec +++ b/CollectionViewPagingLayout.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CollectionViewPagingLayout" - s.version = "1.0.3" + s.version = "1.1.0" s.summary = "A simple but highly customizable layout for UICollectionView and SwiftUI." s.description = <<-DESC @@ -14,9 +14,9 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/amirdew/CollectionViewPagingLayout.git", :tag => "#{s.version}" } s.source_files = ["Lib/**/*.swift"] - s.swift_versions = ["5.4"] + s.swift_versions = ["5.5"] - s.ios.deployment_target = "10.0" + s.ios.deployment_target = "13.0" s.frameworks = "UIKit" s.weak_frameworks = "SwiftUI", "Combine" diff --git a/CollectionViewPagingLayout.xcodeproj/project.pbxproj b/CollectionViewPagingLayout.xcodeproj/project.pbxproj index d96af79..10010f4 100644 --- a/CollectionViewPagingLayout.xcodeproj/project.pbxproj +++ b/CollectionViewPagingLayout.xcodeproj/project.pbxproj @@ -121,6 +121,7 @@ 291EC0DA2610B32500C65A34 /* SwiftUI */ = { isa = PBXGroup; children = ( + 291EC0E22610B32500C65A34 /* SnapshotPageView.swift */, 2967EBA126230A320035540A /* PagePadding.swift */, 291EC0DB2610B32500C65A34 /* PagingCollectionViewControllerBuilder.swift */, 291EC0DC2610B32500C65A34 /* StackPageView.swift */, @@ -130,7 +131,6 @@ 291EC0DF2610B32500C65A34 /* PagingCollectionViewCell.swift */, 291EC0E02610B32500C65A34 /* TransformPageView.swift */, 291EC0E12610B32500C65A34 /* PagingCollectionViewController.swift */, - 291EC0E22610B32500C65A34 /* SnapshotPageView.swift */, ); path = SwiftUI; sourceTree = ""; @@ -294,7 +294,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1240; - LastUpgradeCheck = 1220; + LastUpgradeCheck = 1330; ORGANIZATIONNAME = Amir; TargetAttributes = { 291FDEC2262327FD00AD1C14 = { @@ -513,7 +513,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -571,7 +571,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -594,13 +594,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = CollectionViewPagingLayout/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.0.2; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = amir.app.CollectionViewPagingLayout; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -621,13 +621,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = CollectionViewPagingLayout/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.0.2; + MARKETING_VERSION = 1.1.0; PRODUCT_BUNDLE_IDENTIFIER = amir.app.CollectionViewPagingLayout; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; diff --git a/CollectionViewPagingLayout.xcodeproj/xcshareddata/xcschemes/CollectionViewPagingLayout.xcscheme b/CollectionViewPagingLayout.xcodeproj/xcshareddata/xcschemes/CollectionViewPagingLayout.xcscheme index 2ad420d..250ff93 100644 --- a/CollectionViewPagingLayout.xcodeproj/xcshareddata/xcschemes/CollectionViewPagingLayout.xcscheme +++ b/CollectionViewPagingLayout.xcodeproj/xcshareddata/xcschemes/CollectionViewPagingLayout.xcscheme @@ -1,6 +1,6 @@ 0, scaleOptions.blurEffectEnabled else { scaleBlurViewHost.subviews.first(where: { $0 is BlurEffectView })?.removeFromSuperview() diff --git a/Lib/Stack/StackTransformView.swift b/Lib/Stack/StackTransformView.swift index 3b45745..aa8e4e8 100644 --- a/Lib/Stack/StackTransformView.swift +++ b/Lib/Stack/StackTransformView.swift @@ -187,8 +187,7 @@ public extension StackTransformView { cardView.transform = cardView.transform.rotated(by: angle) } - - @available(iOS 10.0, *) + private func applyBlurEffect(progress: CGFloat) { guard stackOptions.maxBlurEffectRadius > 0, stackOptions.blurEffectEnabled else { stackBlurViewHost.subviews.first(where: { $0 is BlurEffectView })?.removeFromSuperview() diff --git a/Lib/SwiftUI/PagePadding.swift b/Lib/SwiftUI/PagePadding.swift index 6c26ba2..0e2b6b5 100644 --- a/Lib/SwiftUI/PagePadding.swift +++ b/Lib/SwiftUI/PagePadding.swift @@ -6,11 +6,9 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import Foundation import UIKit -@available(iOS 13.0, *) /// Provides paddings around the page public struct PagePadding { @@ -30,4 +28,3 @@ public struct PagePadding { case fractionalWidth(CGFloat) } } -#endif diff --git a/Lib/SwiftUI/PagingCollectionViewCell.swift b/Lib/SwiftUI/PagingCollectionViewCell.swift index 4978ead..73576cf 100644 --- a/Lib/SwiftUI/PagingCollectionViewCell.swift +++ b/Lib/SwiftUI/PagingCollectionViewCell.swift @@ -1,18 +1,7 @@ -// -// PagingCollectionViewCell.swift -// CollectionViewPagingLayout -// -// Created by Amir on 20/03/2021. -// Copyright © 2021 Amir Khorsandi. All rights reserved. -// - -#if canImport(SwiftUI) && canImport(Combine) -import UIKit import SwiftUI +import UIKit -@available(iOS 13.0, *) class PagingCollectionViewCell: UICollectionViewCell { - typealias Parent = PagingCollectionViewController // MARK: Properties @@ -29,7 +18,7 @@ class PagingCollectionViewCell: UICollec func update(value: ValueType, index: IndexPath, parent: Parent) { self.parent = parent - self.viewBuilder = parent.pageViewBuilder + viewBuilder = parent.pageViewBuilder self.value = value self.index = index if hostingController != nil { @@ -53,7 +42,6 @@ class PagingCollectionViewCell: UICollec } } - // MARK: Private functions @discardableResult private func updateView(progress: CGFloat? = nil) -> Content? { @@ -77,7 +65,8 @@ class PagingCollectionViewCell: UICollec func constraint(_ first: NSLayoutAnchor, _ second: NSLayoutAnchor, _ paddingKeyPath: KeyPath, - _ inside: Bool) { + _ inside: Bool) + { let padding = parent.modifierData?.pagePadding?[keyPath: paddingKeyPath] ?? .absolute(0) let constant: CGFloat switch padding { @@ -90,7 +79,8 @@ class PagingCollectionViewCell: UICollec } let identifier = "pagePaddingConstraint_\(inside)_\(T.self)" if let constraint = contentView.constraints.first(where: { $0.identifier == identifier }) ?? - viewController.view.constraints.first(where: { $0.identifier == identifier }) { + viewController.view.constraints.first(where: { $0.identifier == identifier }) + { constraint.constant = constant * (inside ? 1 : -1) } else { let constraint = first.constraint(equalTo: second, constant: constant * (inside ? 1 : -1)) @@ -106,13 +96,11 @@ class PagingCollectionViewCell: UICollec } } - -@available(iOS 13.0, *) extension PagingCollectionViewCell: TransformableView, - ScaleTransformView, - StackTransformView, - SnapshotTransformView { - + ScaleTransformView, + StackTransformView, + SnapshotTransformView +{ var scalableView: UIView { hostingController?.view ?? contentView } @@ -132,9 +120,11 @@ extension PagingCollectionViewCell: TransformableView, var scaleOptions: ScaleTransformViewOptions { parent?.modifierData?.scaleOptions ?? .init() } + var stackOptions: StackTransformViewOptions { parent?.modifierData?.stackOptions ?? .init() } + var snapshotOptions: SnapshotTransformViewOptions { parent?.modifierData?.snapshotOptions ?? .init() } @@ -183,4 +173,3 @@ extension PagingCollectionViewCell: TransformableView, return snapshot.snapshotSize == targetView.bounds.size } } -#endif diff --git a/Lib/SwiftUI/PagingCollectionViewController.swift b/Lib/SwiftUI/PagingCollectionViewController.swift index 0420aff..3969f1e 100644 --- a/Lib/SwiftUI/PagingCollectionViewController.swift +++ b/Lib/SwiftUI/PagingCollectionViewController.swift @@ -6,11 +6,9 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import UIKit import SwiftUI -@available(iOS 13.0, *) public class PagingCollectionViewController: UIViewController, UICollectionViewDataSource, CollectionViewPagingLayoutDelegate, @@ -153,14 +151,12 @@ private protocol PagingCollectionViewControllerEquatableList { func isListSame(as list: [T]) -> Bool } -@available(iOS 13.0, *) extension PagingCollectionViewController: PagingCollectionViewControllerEquatableList where ValueType: Equatable { func isListSame(as list: [T]) -> Bool { self.list == (list as? [ValueType]) } } -@available(iOS 13.0, *) private extension UICollectionView { func registerClass(_ cellType: T.Type, reuseIdentifier: String = T.reuseIdentifier) { register(cellType, forCellWithReuseIdentifier: reuseIdentifier) @@ -172,10 +168,8 @@ private extension UICollectionView { } -@available(iOS 13.0, *) private extension UICollectionViewCell { static var reuseIdentifier: String { String(describing: self) } } -#endif diff --git a/Lib/SwiftUI/PagingCollectionViewControllerBuilder.swift b/Lib/SwiftUI/PagingCollectionViewControllerBuilder.swift index 7853d52..ed15a56 100644 --- a/Lib/SwiftUI/PagingCollectionViewControllerBuilder.swift +++ b/Lib/SwiftUI/PagingCollectionViewControllerBuilder.swift @@ -6,10 +6,8 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import SwiftUI -@available(iOS 13.0, *) public class PagingCollectionViewControllerBuilder { public typealias ViewController = PagingCollectionViewController @@ -78,4 +76,3 @@ public class PagingCollectionViewControllerBuilder() -> WritableKeyPath? func getValue() -> T? } -@available(iOS 13.0, *) struct CollectionViewProperty: CollectionViewPropertyProtocol { let keyPath: WritableKeyPath let value: T @@ -47,4 +43,3 @@ struct CollectionViewProperty: CollectionViewPropertyProtocol { value as? T } } -#endif diff --git a/Lib/SwiftUI/ScalePageView.swift b/Lib/SwiftUI/ScalePageView.swift index 47fbbfe..937324b 100644 --- a/Lib/SwiftUI/ScalePageView.swift +++ b/Lib/SwiftUI/ScalePageView.swift @@ -6,11 +6,9 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import Foundation import SwiftUI -@available(iOS 13.0, *) public struct ScalePageView: UIViewControllerRepresentable, TransformPageViewProtocol { // MARK: Properties @@ -31,11 +29,9 @@ public struct ScalePageView: UIViewC } -@available(iOS 13.0, *) public extension ScalePageView { func options(_ options: ScaleTransformViewOptions) -> Self { builder.modifierData.scaleOptions = options return self } } -#endif diff --git a/Lib/SwiftUI/SnapshotPageView.swift b/Lib/SwiftUI/SnapshotPageView.swift index dda220e..f2c1e87 100644 --- a/Lib/SwiftUI/SnapshotPageView.swift +++ b/Lib/SwiftUI/SnapshotPageView.swift @@ -6,11 +6,9 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import Foundation import SwiftUI -@available(iOS 13.0, *) public struct SnapshotPageView: UIViewControllerRepresentable, TransformPageViewProtocol { // MARK: Properties @@ -31,7 +29,6 @@ public struct SnapshotPageView: UIVi } -@available(iOS 13.0, *) public extension SnapshotPageView { func options(_ options: SnapshotTransformViewOptions) -> Self { builder.modifierData.snapshotOptions = options @@ -39,7 +36,6 @@ public extension SnapshotPageView { } } -@available(iOS 13.0, *) public extension SnapshotPageView { /// A unique identifier for the snapshot, a new snapshot won't be made if /// there is a cashed snapshot with the same identifier @@ -52,7 +48,6 @@ public extension SnapshotPageView { } } -@available(iOS 13.0, *) public extension SnapshotPageView { /// Check if the snapshot can be reused /// - Parameter snapshotContainer: The container for snapshot pieces, see `SnapshotContainerView` @@ -63,4 +58,3 @@ public extension SnapshotPageView { return self } } -#endif diff --git a/Lib/SwiftUI/StackPageView.swift b/Lib/SwiftUI/StackPageView.swift index 75c33cf..6562acc 100644 --- a/Lib/SwiftUI/StackPageView.swift +++ b/Lib/SwiftUI/StackPageView.swift @@ -6,11 +6,9 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import Foundation import SwiftUI -@available(iOS 13.0, *) public struct StackPageView: UIViewControllerRepresentable, TransformPageViewProtocol { // MARK: Properties @@ -31,11 +29,9 @@ public struct StackPageView: UIViewC } -@available(iOS 13.0, *) public extension StackPageView { func options(_ options: StackTransformViewOptions) -> Self { builder.modifierData.stackOptions = options return self } } -#endif diff --git a/Lib/SwiftUI/TransformPageView.swift b/Lib/SwiftUI/TransformPageView.swift index bb1c501..564e728 100644 --- a/Lib/SwiftUI/TransformPageView.swift +++ b/Lib/SwiftUI/TransformPageView.swift @@ -5,11 +5,9 @@ // Created by Amir on 28/03/2021. // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import Foundation import SwiftUI -@available(iOS 13.0, *) public struct TransformPageView: UIViewControllerRepresentable, TransformPageViewProtocol { // MARK: Properties @@ -27,4 +25,3 @@ public struct TransformPageView: UIV builder = .init(data: data, pageViewBuilder: viewBuilder, selection: selection) } } -#endif diff --git a/Lib/SwiftUI/TransformPageViewProtocol.swift b/Lib/SwiftUI/TransformPageViewProtocol.swift index 48b20fa..69b8096 100644 --- a/Lib/SwiftUI/TransformPageViewProtocol.swift +++ b/Lib/SwiftUI/TransformPageViewProtocol.swift @@ -6,11 +6,9 @@ // Copyright © 2021 Amir Khorsandi. All rights reserved. // -#if canImport(SwiftUI) && canImport(Combine) import Foundation import SwiftUI -@available(iOS 13.0, *) public protocol TransformPageViewProtocol { associatedtype ValueType: Identifiable associatedtype PageContent: View @@ -21,7 +19,6 @@ public protocol TransformPageViewProtocol { } -@available(iOS 13.0, *) public extension TransformPageViewProtocol { func numberOfVisibleItems(_ count: Int) -> Self { self.builder.modifierData.numberOfVisibleItems = count @@ -99,7 +96,6 @@ public extension TransformPageViewProtocol { } -@available(iOS 13.0, *) public extension TransformPageViewProtocol where Self: UIViewControllerRepresentable { func makeUIViewController(context: UIViewControllerRepresentableContext) -> Builder.ViewController { builder.make() @@ -109,4 +105,3 @@ public extension TransformPageViewProtocol where Self: UIViewControllerRepresent builder.update(viewController: uiViewController) } } -#endif diff --git a/Package.swift b/Package.swift index 432937f..ec040a6 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "CollectionViewPagingLayout", platforms: [ - .iOS(.v10) + .iOS(.v13) ], products: [ .library( diff --git a/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme b/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme index 2d6c665..c405f46 100644 --- a/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme +++ b/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme @@ -1,6 +1,6 @@