diff --git a/CHANGELOG.md b/CHANGELOG.md index 05d774b4..79f76358 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,14 +3,18 @@ All notable changes to this project will be documented in this file. --- -#### Enhancements -* Reduce computational complexity. #242 -* Adapted for RxSwift 4.2 +## Unreleased + +* Provide a `.custom` option for `ViewTransition`. ## [3.1.0](https://github.com/RxSwiftCommunity/RxDataSources/releases/tag/3.1.0) * Xcode 10.0 compatibility. +#### Enhancements +* Reduce computational complexity. #242 +* Adapted for RxSwift 4.2 + ## [3.0.2](https://github.com/RxSwiftCommunity/RxDataSources/releases/tag/3.0.2) * Makes `configureSupplementaryView` optional for reload data source. #186 diff --git a/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift b/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift index d3fa7076..9ce0a09d 100644 --- a/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift +++ b/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift @@ -23,7 +23,7 @@ open class RxCollectionViewSectionedAnimatedDataSource , RxCollectionViewDataSourceType { public typealias Element = [S] - public typealias DecideViewTransition = (CollectionViewSectionedDataSource, UICollectionView, [Changeset]) -> ViewTransition + public typealias DecideViewTransition = (CollectionViewSectionedDataSource, UICollectionView, [Changeset]) -> ViewTransition // animation configuration public var animationConfiguration: AnimationConfiguration @@ -97,6 +97,9 @@ open class RxCollectionViewSectionedAnimatedDataSource : TableViewSectionedDataSource , RxTableViewDataSourceType { public typealias Element = [S] - public typealias DecideViewTransition = (TableViewSectionedDataSource, UITableView, [Changeset]) -> ViewTransition + public typealias DecideViewTransition = (TableViewSectionedDataSource, UITableView, [Changeset]) -> ViewTransition /// Animation configuration for data source public var animationConfiguration: AnimationConfiguration @@ -107,7 +107,9 @@ open class RxTableViewSectionedAnimatedDataSource case .reload: self.setSections(newSections) tableView.reloadData() - return + case .custom(let actions): + self.setSections(newSections) + actions(tableView) } } catch let e { diff --git a/Sources/RxDataSources/ViewTransition.swift b/Sources/RxDataSources/ViewTransition.swift index 35299f0c..15cfe4e4 100644 --- a/Sources/RxDataSources/ViewTransition.swift +++ b/Sources/RxDataSources/ViewTransition.swift @@ -7,10 +7,11 @@ // /// Transition between two view states -public enum ViewTransition { +public enum ViewTransition { /// animated transition case animated /// refresh view without animations case reload + /// perform custom behavior + case custom((T) -> Void) } -