Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Commit

Permalink
Bump minimum to 13.0 (#70)
Browse files Browse the repository at this point in the history
* Bump minimum iOS to 13

* remove min ios 10
  • Loading branch information
Amir Khorsandi authored Apr 4, 2022
1 parent b565d1e commit 4bdec32
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 87 deletions.
6 changes: 3 additions & 3 deletions CollectionViewPagingLayout.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions CollectionViewPagingLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
291EC0DA2610B32500C65A34 /* SwiftUI */ = {
isa = PBXGroup;
children = (
291EC0E22610B32500C65A34 /* SnapshotPageView.swift */,
2967EBA126230A320035540A /* PagePadding.swift */,
291EC0DB2610B32500C65A34 /* PagingCollectionViewControllerBuilder.swift */,
291EC0DC2610B32500C65A34 /* StackPageView.swift */,
Expand All @@ -130,7 +131,6 @@
291EC0DF2610B32500C65A34 /* PagingCollectionViewCell.swift */,
291EC0E02610B32500C65A34 /* TransformPageView.swift */,
291EC0E12610B32500C65A34 /* PagingCollectionViewController.swift */,
291EC0E22610B32500C65A34 /* SnapshotPageView.swift */,
);
path = SwiftUI;
sourceTree = "<group>";
Expand Down Expand Up @@ -294,7 +294,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1220;
LastUpgradeCheck = 1330;
ORGANIZATIONNAME = Amir;
TargetAttributes = {
291FDEC2262327FD00AD1C14 = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 0 additions & 1 deletion Lib/BlurEffectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import UIKit

@available(iOS 10.0, *)
public class BlurEffectView: UIVisualEffectView {

// MARK: Parameters
Expand Down
3 changes: 1 addition & 2 deletions Lib/Scale/ScaleTransformView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ public extension ScaleTransformView {
}
scalableView.layer.transform = transform
}

@available(iOS 10.0, *)

private func applyBlurEffect(progress: CGFloat) {
guard scaleOptions.blurEffectRadiusRatio > 0, scaleOptions.blurEffectEnabled else {
scaleBlurViewHost.subviews.first(where: { $0 is BlurEffectView })?.removeFromSuperview()
Expand Down
3 changes: 1 addition & 2 deletions Lib/Stack/StackTransformView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions Lib/SwiftUI/PagePadding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -30,4 +28,3 @@ public struct PagePadding {
case fractionalWidth(CGFloat)
}
}
#endif
35 changes: 12 additions & 23 deletions Lib/SwiftUI/PagingCollectionViewCell.swift
Original file line number Diff line number Diff line change
@@ -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<ValueType: Identifiable, Content: View>: UICollectionViewCell {

typealias Parent = PagingCollectionViewController<ValueType, Content>

// MARK: Properties
Expand All @@ -29,7 +18,7 @@ class PagingCollectionViewCell<ValueType: Identifiable, Content: View>: 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 {
Expand All @@ -53,7 +42,6 @@ class PagingCollectionViewCell<ValueType: Identifiable, Content: View>: UICollec
}
}


// MARK: Private functions

@discardableResult private func updateView(progress: CGFloat? = nil) -> Content? {
Expand All @@ -77,7 +65,8 @@ class PagingCollectionViewCell<ValueType: Identifiable, Content: View>: UICollec
func constraint<T>(_ first: NSLayoutAnchor<T>,
_ second: NSLayoutAnchor<T>,
_ paddingKeyPath: KeyPath<PagePadding, PagePadding.Padding?>,
_ inside: Bool) {
_ inside: Bool)
{
let padding = parent.modifierData?.pagePadding?[keyPath: paddingKeyPath] ?? .absolute(0)
let constant: CGFloat
switch padding {
Expand All @@ -90,7 +79,8 @@ class PagingCollectionViewCell<ValueType: Identifiable, Content: View>: 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))
Expand All @@ -106,13 +96,11 @@ class PagingCollectionViewCell<ValueType: Identifiable, Content: View>: UICollec
}
}


@available(iOS 13.0, *)
extension PagingCollectionViewCell: TransformableView,
ScaleTransformView,
StackTransformView,
SnapshotTransformView {

ScaleTransformView,
StackTransformView,
SnapshotTransformView
{
var scalableView: UIView {
hostingController?.view ?? contentView
}
Expand All @@ -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()
}
Expand Down Expand Up @@ -183,4 +173,3 @@ extension PagingCollectionViewCell: TransformableView,
return snapshot.snapshotSize == targetView.bounds.size
}
}
#endif
6 changes: 0 additions & 6 deletions Lib/SwiftUI/PagingCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValueType: Identifiable, PageContent: View>: UIViewController,
UICollectionViewDataSource,
CollectionViewPagingLayoutDelegate,
Expand Down Expand Up @@ -153,14 +151,12 @@ private protocol PagingCollectionViewControllerEquatableList {
func isListSame<T>(as list: [T]) -> Bool
}

@available(iOS 13.0, *)
extension PagingCollectionViewController: PagingCollectionViewControllerEquatableList where ValueType: Equatable {
func isListSame<T>(as list: [T]) -> Bool {
self.list == (list as? [ValueType])
}
}

@available(iOS 13.0, *)
private extension UICollectionView {
func registerClass<T: UICollectionViewCell>(_ cellType: T.Type, reuseIdentifier: String = T.reuseIdentifier) {
register(cellType, forCellWithReuseIdentifier: reuseIdentifier)
Expand All @@ -172,10 +168,8 @@ private extension UICollectionView {
}


@available(iOS 13.0, *)
private extension UICollectionViewCell {
static var reuseIdentifier: String {
String(describing: self)
}
}
#endif
3 changes: 0 additions & 3 deletions Lib/SwiftUI/PagingCollectionViewControllerBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValueType: Identifiable, PageContent: View> {

public typealias ViewController = PagingCollectionViewController<ValueType, PageContent>
Expand Down Expand Up @@ -78,4 +76,3 @@ public class PagingCollectionViewControllerBuilder<ValueType: Identifiable, Page
}
}
}
#endif
5 changes: 0 additions & 5 deletions Lib/SwiftUI/PagingCollectionViewModifierData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
// Copyright © 2021 Amir Khorsandi. All rights reserved.
//

#if canImport(SwiftUI) && canImport(Combine)
import Foundation
import UIKit

@available(iOS 13.0, *)
struct PagingCollectionViewModifierData {
var scaleOptions: ScaleTransformViewOptions?
var stackOptions: StackTransformViewOptions?
Expand All @@ -28,13 +26,11 @@ struct PagingCollectionViewModifierData {
var transparentAttributeWhenCellNotLoaded: Bool?
}

@available(iOS 13.0, *)
protocol CollectionViewPropertyProtocol {
func getKey<T>() -> WritableKeyPath<UICollectionView, T>?
func getValue<T>() -> T?
}

@available(iOS 13.0, *)
struct CollectionViewProperty<T>: CollectionViewPropertyProtocol {
let keyPath: WritableKeyPath<UICollectionView, T>
let value: T
Expand All @@ -47,4 +43,3 @@ struct CollectionViewProperty<T>: CollectionViewPropertyProtocol {
value as? T
}
}
#endif
4 changes: 0 additions & 4 deletions Lib/SwiftUI/ScalePageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValueType: Identifiable, PageContent: View>: UIViewControllerRepresentable, TransformPageViewProtocol {

// MARK: Properties
Expand All @@ -31,11 +29,9 @@ public struct ScalePageView<ValueType: Identifiable, PageContent: View>: UIViewC
}


@available(iOS 13.0, *)
public extension ScalePageView {
func options(_ options: ScaleTransformViewOptions) -> Self {
builder.modifierData.scaleOptions = options
return self
}
}
#endif
6 changes: 0 additions & 6 deletions Lib/SwiftUI/SnapshotPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ValueType: Identifiable, PageContent: View>: UIViewControllerRepresentable, TransformPageViewProtocol {

// MARK: Properties
Expand All @@ -31,15 +29,13 @@ public struct SnapshotPageView<ValueType: Identifiable, PageContent: View>: UIVi
}


@available(iOS 13.0, *)
public extension SnapshotPageView {
func options(_ options: SnapshotTransformViewOptions) -> Self {
builder.modifierData.snapshotOptions = options
return self
}
}

@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
Expand All @@ -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`
Expand All @@ -63,4 +58,3 @@ public extension SnapshotPageView {
return self
}
}
#endif
Loading

0 comments on commit 4bdec32

Please sign in to comment.