From f890fb58e071d5d2e33072c5669b0ab629d3272f Mon Sep 17 00:00:00 2001 From: Pavel Lukandiy Date: Mon, 21 May 2018 20:32:52 +0300 Subject: [PATCH 1/7] Implemented wrapper ui delegate --- LeadKit.xcodeproj/project.pbxproj | 12 ++- .../PaginationWrapper.swift | 26 ++++--- ...perUIDelegate+DefaultImplementation.swift} | 12 +-- .../PaginationWrapperDelegate.swift | 50 ------------- .../PaginationWrapperUIDelegate.swift | 73 +++++++++++++++++++ 5 files changed, 97 insertions(+), 76 deletions(-) rename Sources/Extensions/DataLoading/PaginationDataLoading/{PaginationWrapperDelegate+DefaultImplementation.swift => PaginationWrapperUIDelegate+DefaultImplementation.swift} (88%) create mode 100644 Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate.swift diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index e7db21a3..f0163709 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -363,7 +363,7 @@ 6774526C206249E30024EEEF /* UICollectionView+PaginationWrappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */; }; 6774526D206249E30024EEEF /* UICollectionView+PaginationWrappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */; }; 6774526E206249E30024EEEF /* UICollectionView+PaginationWrappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */; }; - 6774527020624A2A0024EEEF /* PaginationWrapperDelegate+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774526F20624A2A0024EEEF /* PaginationWrapperDelegate+DefaultImplementation.swift */; }; + 6774527020624A2A0024EEEF /* PaginationWrapperUIDelegate+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774526F20624A2A0024EEEF /* PaginationWrapperUIDelegate+DefaultImplementation.swift */; }; 6774527420624E820024EEEF /* DataLoadingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774527320624E820024EEEF /* DataLoadingModel.swift */; }; 6774527520624E820024EEEF /* DataLoadingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774527320624E820024EEEF /* DataLoadingModel.swift */; }; 6774527620624E820024EEEF /* DataLoadingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6774527320624E820024EEEF /* DataLoadingModel.swift */; }; @@ -503,6 +503,7 @@ 67FDC2601FA310EA00C76A77 /* RequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FDC25E1FA310EA00C76A77 /* RequestError.swift */; }; 67FDC2611FA310EA00C76A77 /* RequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FDC25E1FA310EA00C76A77 /* RequestError.swift */; }; 67FDC2621FA310EA00C76A77 /* RequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FDC25E1FA310EA00C76A77 /* RequestError.swift */; }; + 825F8F2820B3384C00594857 /* PaginationWrapperUIDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825F8F2720B3384C00594857 /* PaginationWrapperUIDelegate.swift */; }; 82F8BB181F5DDED100C1061B /* Single+DeferredJust.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82F8BB171F5DDED100C1061B /* Single+DeferredJust.swift */; }; A658E54D1F8CD7790093527A /* TableRow+SeparatorsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A658E54C1F8CD7790093527A /* TableRow+SeparatorsExtensions.swift */; }; A658E54E1F8CD7790093527A /* TableRow+SeparatorsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A658E54C1F8CD7790093527A /* TableRow+SeparatorsExtensions.swift */; }; @@ -717,7 +718,7 @@ 6771DFE91EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DateFormattingService+MappingTransform.swift"; sourceTree = ""; }; 67745267206249360024EEEF /* UITableView+PaginationWrappable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+PaginationWrappable.swift"; sourceTree = ""; }; 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+PaginationWrappable.swift"; sourceTree = ""; }; - 6774526F20624A2A0024EEEF /* PaginationWrapperDelegate+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PaginationWrapperDelegate+DefaultImplementation.swift"; sourceTree = ""; }; + 6774526F20624A2A0024EEEF /* PaginationWrapperUIDelegate+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PaginationWrapperUIDelegate+DefaultImplementation.swift"; sourceTree = ""; }; 6774527320624E820024EEEF /* DataLoadingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataLoadingModel.swift; sourceTree = ""; }; 67745278206252020024EEEF /* DataLoadingState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataLoadingState.swift; sourceTree = ""; }; 6774527F206256A20024EEEF /* RxDataLoadingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxDataLoadingModel.swift; sourceTree = ""; }; @@ -768,6 +769,7 @@ 67FD4381206BD24B005B0C64 /* EqutableOptionalArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EqutableOptionalArray.swift; sourceTree = ""; }; 67FDC25E1FA310EA00C76A77 /* RequestError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestError.swift; sourceTree = ""; }; 78405D3B3D3C3E17456877FF /* Pods_LeadKit_iOSTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_iOSTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 825F8F2720B3384C00594857 /* PaginationWrapperUIDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginationWrapperUIDelegate.swift; sourceTree = ""; }; 82F8BB171F5DDED100C1061B /* Single+DeferredJust.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Single+DeferredJust.swift"; sourceTree = ""; }; 8590CA7831555C295C5DC572 /* Pods_LeadKit_LeadKit_watchOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_LeadKit_watchOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 887F99C5326BD220C2811BD6 /* Pods_LeadKit_LeadKit_iOS_Extensions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_LeadKit_iOS_Extensions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1465,7 +1467,7 @@ 67745266206248F00024EEEF /* PaginationDataLoading */ = { isa = PBXGroup; children = ( - 6774526F20624A2A0024EEEF /* PaginationWrapperDelegate+DefaultImplementation.swift */, + 6774526F20624A2A0024EEEF /* PaginationWrapperUIDelegate+DefaultImplementation.swift */, 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */, 67745267206249360024EEEF /* UITableView+PaginationWrappable.swift */, ); @@ -1544,6 +1546,7 @@ children = ( 67EB7FFC206176C900BDD9FB /* AnyPaginationWrappable.swift */, 67EB8000206177D600BDD9FB /* PaginationWrapperDelegate.swift */, + 825F8F2720B3384C00594857 /* PaginationWrapperUIDelegate.swift */, ); path = PaginationDataLoading; sourceTree = ""; @@ -2591,6 +2594,7 @@ 67EB8001206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */, 67FD4382206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */, 6774529A20625E5B0024EEEF /* PaginationDataLoadingState.swift in Sources */, + 825F8F2820B3384C00594857 /* PaginationWrapperUIDelegate.swift in Sources */, 678D26A020692BFF00B05B93 /* TextFieldViewEvents.swift in Sources */, 6727478F206CD88600725163 /* DateFormattingService.swift in Sources */, 678D26A420692BFF00B05B93 /* TextFieldViewModelEvents.swift in Sources */, @@ -2690,7 +2694,7 @@ 671463981EB3396E00EAB194 /* AnyLoadingIndicator.swift in Sources */, 671463A71EB340C000EAB194 /* UIViewController+ConfigurableController.swift in Sources */, 671463141EB3396E00EAB194 /* UIViewController+TopVisibleViewController.swift in Sources */, - 6774527020624A2A0024EEEF /* PaginationWrapperDelegate+DefaultImplementation.swift in Sources */, + 6774527020624A2A0024EEEF /* PaginationWrapperUIDelegate+DefaultImplementation.swift in Sources */, 6727478A206CD83600725163 /* DateFormat.swift in Sources */, 67745280206256A20024EEEF /* RxDataLoadingModel.swift in Sources */, A6F32C081F6EBDAA00AC08EE /* String+LocalizedComponent.swift in Sources */, diff --git a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift index e222f183..9411263b 100644 --- a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift +++ b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift @@ -25,7 +25,9 @@ import RxCocoa import UIScrollView_InfiniteScroll /// Class that connects PaginationDataLoadingModel with UIScrollView. It handles all non-visual and visual states. -final public class PaginationWrapper +final public class PaginationWrapper // "Segmentation fault: 11" in Xcode 9.2 without redundant same-type constraint :( where Cursor == Delegate.DataSourceType, Cursor.ResultType == [Cursor.Element] { @@ -36,6 +38,7 @@ final public class PaginationWrapper UIView { return TextPlaceholderView(title: .empty) @@ -68,14 +68,4 @@ public extension PaginationWrapperDelegate { func footerRetryButtonWillDisappear() { // by default - nothing will happen } - -} - -public extension PaginationWrapperDelegate - where DataSourceType: ResettableRxDataSourceCursor, - DataSourceType.ResultType == [DataSourceType.Element] { - - /// Convenient typealias. - typealias PaginationWrapperType = PaginationWrapper - } diff --git a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift index 97f181d6..a372e74d 100644 --- a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift +++ b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift @@ -42,56 +42,6 @@ public protocol PaginationWrapperDelegate: class { func paginationWrapper(didReload allItems: DataSourceType.ResultType, using dataSource: DataSourceType) - /// Returns placeholder view for empty state. - /// - /// - Returns: Configured instace of UIView. - func emptyPlaceholder() -> UIView - - /// Called when initial loading error is occured. - /// It should return true if error is handled and false if it doesn't. - /// - /// - Parameters: - /// - error: Error that occured due data loading. - /// - Returns: Bool value. If true - then error placeholder wouldn't be shown. - func customInitialLoadingErrorHandling(for error: Error) -> Bool - - /// Returns placeholder view for error state. - /// - /// - Parameters: - /// - error: Error that occured due data loading. - /// - Returns: Configured instace of UIView. - func errorPlaceholder(for error: Error) -> UIView - - /// Returns loading idicator for initial loading state. - /// This indicator will appear at center of the placeholders container. - /// - /// - Returns: Configured instace of AnyLoadingIndicator. - func initialLoadingIndicator() -> AnyLoadingIndicator - - /// Returns loading idicator for initial loading state. - /// - /// - Returns: Configured instace of AnyLoadingIndicator. - func loadingMoreIndicator() -> AnyLoadingIndicator - - /// Returns instance of UIButton for "retry load more" action. - /// - /// - Returns: Configured instace of AnyLoadingIndicator. - func footerRetryButton() -> UIButton - - /// Returns height for "retry load more" button. - /// - /// - Returns: Height of "retry load more" button. - func footerRetryButtonHeight() -> CGFloat - - /// Method is called before "retry load more" will be shown. - /// Typically, it's used when you need to show custom footer view. - func footerRetryButtonWillAppear() - - /// Method is called before "retry load more" will be hidden. - /// Typically, it's used when you need to hide custom footer view. - func footerRetryButtonWillDisappear() - /// Clears view when placeholder is shown. func clearView() - } diff --git a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate.swift b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate.swift new file mode 100644 index 00000000..c3c32093 --- /dev/null +++ b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperUIDelegate.swift @@ -0,0 +1,73 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +public protocol PaginationWrapperUIDelegate: class { + + /// Returns placeholder view for empty state. + /// + /// - Returns: Configured instace of UIView. + func emptyPlaceholder() -> UIView? + + /// Called when initial loading error is occured. + /// It should return true if error is handled and false if it doesn't. + /// + /// - Parameters: + /// - error: Error that occured due data loading. + /// - Returns: Bool value. If true - then error placeholder wouldn't be shown. + func customInitialLoadingErrorHandling(for error: Error) -> Bool + + /// Returns placeholder view for error state. + /// + /// - Parameters: + /// - error: Error that occured due data loading. + /// - Returns: Configured instace of UIView. + func errorPlaceholder(for error: Error) -> UIView? + + /// Returns loading idicator for initial loading state. + /// This indicator will appear at center of the placeholders container. + /// + /// - Returns: Configured instace of AnyLoadingIndicator. + func initialLoadingIndicator() -> AnyLoadingIndicator? + + /// Returns loading idicator for initial loading state. + /// + /// - Returns: Configured instace of AnyLoadingIndicator. + func loadingMoreIndicator() -> AnyLoadingIndicator? + + /// Returns instance of UIButton for "retry load more" action. + /// + /// - Returns: Configured instace of AnyLoadingIndicator. + func footerRetryButton() -> UIButton? + + /// Returns height for "retry load more" button. + /// + /// - Returns: Height of "retry load more" button. + func footerRetryButtonHeight() -> CGFloat + + /// Method is called before "retry load more" will be shown. + /// Typically, it's used when you need to show custom footer view. + func footerRetryButtonWillAppear() + + /// Method is called before "retry load more" will be hidden. + /// Typically, it's used when you need to hide custom footer view. + func footerRetryButtonWillDisappear() +} From a6ce1288baad3c9c62322970450100af7c4ce9ce Mon Sep 17 00:00:00 2001 From: Pavel Lukandiy Date: Mon, 21 May 2018 20:44:51 +0300 Subject: [PATCH 2/7] Removed UI delegate generic --- .../PaginationDataLoading/PaginationWrapper.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift index 9411263b..7e9792d4 100644 --- a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift +++ b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift @@ -25,9 +25,7 @@ import RxCocoa import UIScrollView_InfiniteScroll /// Class that connects PaginationDataLoadingModel with UIScrollView. It handles all non-visual and visual states. -final public class PaginationWrapper +final public class PaginationWrapper // "Segmentation fault: 11" in Xcode 9.2 without redundant same-type constraint :( where Cursor == Delegate.DataSourceType, Cursor.ResultType == [Cursor.Element] { @@ -38,7 +36,7 @@ final public class PaginationWrapper Date: Mon, 21 May 2018 21:09:56 +0300 Subject: [PATCH 3/7] Refactor and fix annotations --- .../PaginationDataLoading/PaginationWrapper.swift | 7 +++---- .../PaginationDataLoading/PaginationWrapperDelegate.swift | 7 +++---- .../PaginationWrapperUIDelegate.swift | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift index 7e9792d4..a804d3a3 100644 --- a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift +++ b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift @@ -177,15 +177,14 @@ final public class PaginationWrapper Date: Mon, 21 May 2018 21:16:49 +0300 Subject: [PATCH 4/7] Version up --- CHANGELOG.md | 3 +++ LeadKit.podspec | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a16894f3..827cf0d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +### 0.7.14 +- **Update**: `PaginationWrapper` separating state views from data loading. + ### 0.7.13 - **Update**: Migrate from `Variable` to `BehaviorRelay`. - **Fix**: `PaginationWrapper` retry load more after fail. diff --git a/LeadKit.podspec b/LeadKit.podspec index b7b6206d..0a91f9db 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.7.13" + s.version = "0.7.14" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" From c49a05270f875c41f44642c98ed56cf937f51db2 Mon Sep 17 00:00:00 2001 From: Pavel Lukandiy Date: Mon, 21 May 2018 21:18:10 +0300 Subject: [PATCH 5/7] UI delegate default parameter --- .../DataLoading/PaginationDataLoading/PaginationWrapper.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift index a804d3a3..9a206fa9 100644 --- a/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift +++ b/Sources/Classes/DataLoading/PaginationDataLoading/PaginationWrapper.swift @@ -76,7 +76,7 @@ final public class PaginationWrapper Date: Tue, 22 May 2018 14:03:40 +0300 Subject: [PATCH 6/7] Review notes --- CHANGELOG.md | 2 +- .../PaginationDataLoading/PaginationWrapperDelegate.swift | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 827cf0d5..44a1875c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog ### 0.7.14 -- **Update**: `PaginationWrapper` separating state views from data loading. +- **[Breaking Change]**: `PaginationWrapper` separating state views from data loading. ### 0.7.13 - **Update**: Migrate from `Variable` to `BehaviorRelay`. diff --git a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift index c33bde08..8ee35da1 100644 --- a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift +++ b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift @@ -44,3 +44,11 @@ public protocol PaginationWrapperDelegate: class { /// Handles empty data state. func clearData() } + +public extension PaginationWrapperDelegate + where DataSourceType: ResettableRxDataSourceCursor, + DataSourceType.ResultType == [DataSourceType.Element] { + + /// Convenient typealias. + typealias PaginationWrapperType = PaginationWrapper +} From a9536d3cff154e90fd688861f5f6c275e340e688 Mon Sep 17 00:00:00 2001 From: Pavel Lukandiy Date: Tue, 22 May 2018 14:54:18 +0300 Subject: [PATCH 7/7] Targets fix --- LeadKit.xcodeproj/project.pbxproj | 8 ++--- ...rapperDelegate+DefaultImplementation.swift | 29 +++++++++++++++++++ .../PaginationWrapperDelegate.swift | 8 ----- 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperDelegate+DefaultImplementation.swift diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index f0163709..f7430027 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -493,8 +493,6 @@ 67EB7FFE206176C900BDD9FB /* AnyPaginationWrappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67EB7FFC206176C900BDD9FB /* AnyPaginationWrappable.swift */; }; 67EB7FFF206176C900BDD9FB /* AnyPaginationWrappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67EB7FFC206176C900BDD9FB /* AnyPaginationWrappable.swift */; }; 67EB8001206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67EB8000206177D600BDD9FB /* PaginationWrapperDelegate.swift */; }; - 67EB8002206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67EB8000206177D600BDD9FB /* PaginationWrapperDelegate.swift */; }; - 67EB8003206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67EB8000206177D600BDD9FB /* PaginationWrapperDelegate.swift */; }; 67FD4382206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FD4381206BD24B005B0C64 /* EqutableOptionalArray.swift */; }; 67FD4383206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FD4381206BD24B005B0C64 /* EqutableOptionalArray.swift */; }; 67FD4384206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FD4381206BD24B005B0C64 /* EqutableOptionalArray.swift */; }; @@ -503,6 +501,7 @@ 67FDC2601FA310EA00C76A77 /* RequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FDC25E1FA310EA00C76A77 /* RequestError.swift */; }; 67FDC2611FA310EA00C76A77 /* RequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FDC25E1FA310EA00C76A77 /* RequestError.swift */; }; 67FDC2621FA310EA00C76A77 /* RequestError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FDC25E1FA310EA00C76A77 /* RequestError.swift */; }; + 820CAD8420B43B080033EF94 /* PaginationWrapperDelegate+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820CAD8320B43B080033EF94 /* PaginationWrapperDelegate+DefaultImplementation.swift */; }; 825F8F2820B3384C00594857 /* PaginationWrapperUIDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825F8F2720B3384C00594857 /* PaginationWrapperUIDelegate.swift */; }; 82F8BB181F5DDED100C1061B /* Single+DeferredJust.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82F8BB171F5DDED100C1061B /* Single+DeferredJust.swift */; }; A658E54D1F8CD7790093527A /* TableRow+SeparatorsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A658E54C1F8CD7790093527A /* TableRow+SeparatorsExtensions.swift */; }; @@ -769,6 +768,7 @@ 67FD4381206BD24B005B0C64 /* EqutableOptionalArray.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EqutableOptionalArray.swift; sourceTree = ""; }; 67FDC25E1FA310EA00C76A77 /* RequestError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestError.swift; sourceTree = ""; }; 78405D3B3D3C3E17456877FF /* Pods_LeadKit_iOSTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_iOSTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 820CAD8320B43B080033EF94 /* PaginationWrapperDelegate+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PaginationWrapperDelegate+DefaultImplementation.swift"; sourceTree = ""; }; 825F8F2720B3384C00594857 /* PaginationWrapperUIDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginationWrapperUIDelegate.swift; sourceTree = ""; }; 82F8BB171F5DDED100C1061B /* Single+DeferredJust.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Single+DeferredJust.swift"; sourceTree = ""; }; 8590CA7831555C295C5DC572 /* Pods_LeadKit_LeadKit_watchOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKit_LeadKit_watchOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1468,6 +1468,7 @@ isa = PBXGroup; children = ( 6774526F20624A2A0024EEEF /* PaginationWrapperUIDelegate+DefaultImplementation.swift */, + 820CAD8320B43B080033EF94 /* PaginationWrapperDelegate+DefaultImplementation.swift */, 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */, 67745267206249360024EEEF /* UITableView+PaginationWrappable.swift */, ); @@ -2720,6 +2721,7 @@ 6714628C1EB3396E00EAB194 /* CGImage+Alpha.swift in Sources */, 671462741EB3396E00EAB194 /* LeadKitError.swift in Sources */, 677452A420625FA90024EEEF /* RxDataSource.swift in Sources */, + 820CAD8420B43B080033EF94 /* PaginationWrapperDelegate+DefaultImplementation.swift in Sources */, 671AD262206A35EC00EAF887 /* UIApplication+Cellular.swift in Sources */, 671462D81EB3396E00EAB194 /* TimeInterval+DateComponents.swift in Sources */, 6714638C1EB3396E00EAB194 /* SolidFillDrawingOperation.swift in Sources */, @@ -2880,7 +2882,6 @@ 678D26A320692BFF00B05B93 /* TextFieldViewEvents.swift in Sources */, 67153E43207DFBA80049D8C0 /* FloatingPoint+DegreesRadiansConvertion.swift in Sources */, 67745283206256A20024EEEF /* RxDataLoadingModel.swift in Sources */, - 67EB8003206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */, 671463571EB3396E00EAB194 /* StaticViewHeightProtocol.swift in Sources */, 671463631EB3396E00EAB194 /* SupportProtocol.swift in Sources */, 671462871EB3396E00EAB194 /* CGContext+Initializers.swift in Sources */, @@ -3085,7 +3086,6 @@ 6774526D206249E30024EEEF /* UICollectionView+PaginationWrappable.swift in Sources */, 6714627D1EB3396E00EAB194 /* AlamofireManager+Extensions.swift in Sources */, 673CF4352063E29B00C329F6 /* TextWithButtonPlaceholder.swift in Sources */, - 67EB8002206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */, 6727476F206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */, 673CF4232063D90600C329F6 /* DisposeBagHolder.swift in Sources */, 677452AA206263360024EEEF /* CursorType+RxDataSourceDefaultImplementation.swift in Sources */, diff --git a/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperDelegate+DefaultImplementation.swift b/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperDelegate+DefaultImplementation.swift new file mode 100644 index 00000000..7e11893f --- /dev/null +++ b/Sources/Extensions/DataLoading/PaginationDataLoading/PaginationWrapperDelegate+DefaultImplementation.swift @@ -0,0 +1,29 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +public extension PaginationWrapperDelegate + where DataSourceType: ResettableRxDataSourceCursor, + DataSourceType.ResultType == [DataSourceType.Element] { + + /// Convenient typealias. + typealias PaginationWrapperType = PaginationWrapper +} diff --git a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift index 8ee35da1..c33bde08 100644 --- a/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift +++ b/Sources/Structures/DataLoading/PaginationDataLoading/PaginationWrapperDelegate.swift @@ -44,11 +44,3 @@ public protocol PaginationWrapperDelegate: class { /// Handles empty data state. func clearData() } - -public extension PaginationWrapperDelegate - where DataSourceType: ResettableRxDataSourceCursor, - DataSourceType.ResultType == [DataSourceType.Element] { - - /// Convenient typealias. - typealias PaginationWrapperType = PaginationWrapper -}