From 96a59c809eb2174f16819c31194902b54f7511bd Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Wed, 21 Mar 2018 18:55:53 +0300 Subject: [PATCH] add conformance to RxDataSource --- Sources/Classes/DataLoading/Cursors/FixedPageCursor.swift | 6 +++++- Sources/Classes/DataLoading/Cursors/MapCursor.swift | 6 +++++- Sources/Classes/DataLoading/Cursors/StaticCursor.swift | 4 +++- Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Sources/Classes/DataLoading/Cursors/FixedPageCursor.swift b/Sources/Classes/DataLoading/Cursors/FixedPageCursor.swift index df4c4ca8..44094546 100644 --- a/Sources/Classes/DataLoading/Cursors/FixedPageCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/FixedPageCursor.swift @@ -23,7 +23,9 @@ import RxSwift /// Paging cursor implementation with enclosed cursor for fetching results -public class FixedPageCursor: CursorType { +public class FixedPageCursor: CursorType, RxDataSource { + + public typealias ResultType = [Element] fileprivate let cursor: Cursor @@ -76,6 +78,8 @@ public class FixedPageCursor: CursorType { /// FixedPageCursor subclass with implementation of ResettableType public class ResettableFixedPageCursor: FixedPageCursor, ResettableType { + public typealias ResultType = [Element] + public override init(cursor: Cursor, pageSize: Int) { super.init(cursor: cursor, pageSize: pageSize) } diff --git a/Sources/Classes/DataLoading/Cursors/MapCursor.swift b/Sources/Classes/DataLoading/Cursors/MapCursor.swift index 69647bc9..af29dff3 100644 --- a/Sources/Classes/DataLoading/Cursors/MapCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/MapCursor.swift @@ -45,7 +45,9 @@ public extension CursorType { } /// Map cursor implementation with enclosed cursor for fetching results -public class MapCursor: CursorType { +public class MapCursor: CursorType, RxDataSource { + + public typealias ResultType = [Element] public typealias Transform = (Cursor.Element) -> T? @@ -91,6 +93,8 @@ public class MapCursor: CursorType { /// MapCursor subclass with implementation of ResettableType public class ResettableMapCursor: MapCursor, ResettableType { + public typealias ResultType = [Cursor.Element] + public override init(cursor: Cursor, transform: @escaping Transform) { super.init(cursor: cursor, transform: transform) } diff --git a/Sources/Classes/DataLoading/Cursors/StaticCursor.swift b/Sources/Classes/DataLoading/Cursors/StaticCursor.swift index fca71d1b..a4bca0c5 100644 --- a/Sources/Classes/DataLoading/Cursors/StaticCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/StaticCursor.swift @@ -23,7 +23,9 @@ import RxSwift /// Stub cursor implementation for array content type -public class StaticCursor: ResettableCursorType { +public class StaticCursor: ResettableRxDataSourceCursor { + + public typealias ResultType = [Element] private let content: [Element] diff --git a/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift b/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift index a13b0aeb..6acf47b0 100644 --- a/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift @@ -23,7 +23,7 @@ import RxSwift import RxCocoa -public final class TotalCountCursor: ResettableCursorType { +public final class TotalCountCursor: ResettableRxDataSourceCursor { public typealias Element = CursorConfiguration.ResultType.ElementType public typealias ResultType = [Element]