From eddc2f6b0841e0f1bd609e5cfca5078806f9759e Mon Sep 17 00:00:00 2001 From: Amir Khorsandi Date: Sun, 7 Nov 2021 12:13:33 +0100 Subject: [PATCH] Compare data using Equatable if it conforms to --- .../PagingCollectionViewController.swift | 21 +++++++++++++++++-- .../xcschemes/PagingLayoutSamples.xcscheme | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Lib/SwiftUI/PagingCollectionViewController.swift b/Lib/SwiftUI/PagingCollectionViewController.swift index 5ad46ef..0420aff 100644 --- a/Lib/SwiftUI/PagingCollectionViewController.swift +++ b/Lib/SwiftUI/PagingCollectionViewController.swift @@ -57,9 +57,16 @@ public class PagingCollectionViewController(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 { diff --git a/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme b/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme index 7b639a9..2d6c665 100644 --- a/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme +++ b/Samples/PagingLayoutSamples.xcodeproj/xcshareddata/xcschemes/PagingLayoutSamples.xcscheme @@ -1,6 +1,6 @@