@@ -20,22 +20,6 @@ class NumberSectionView : UICollectionReusableView {
20
20
@IBOutlet weak var value : UILabel ?
21
21
}
22
22
23
- extension ObservableType {
24
- func implicitTransaction( ) -> Observable < E > {
25
- return Observable . create { observer in
26
- return self . subscribe { event in
27
- UIView . setAnimationDuration ( 5.0 )
28
- //CATransaction.begin()
29
- //CATransaction.setAnimationDuration(5.0)
30
- //UIView.animate(withDuration: 3.0) {
31
- observer. on ( event)
32
- //}
33
- //CATransaction.commit()
34
- }
35
- }
36
- }
37
- }
38
-
39
23
class ViewController : UIViewController {
40
24
41
25
@IBOutlet weak var animatedTableView : UITableView !
@@ -74,33 +58,12 @@ class ViewController: UIViewController {
74
58
. bindTo ( tableView. rx. items ( dataSource: reloadDataSource) )
75
59
. addDisposableTo ( disposeBag)
76
60
77
- // Collection view logic works, but when clicking fast because of internal bugs
78
- // collection view will sometimes get confused. I know what you are thinking,
79
- // but this is really not a bug in the algorithm. The generated changes are
80
- // pseudorandom, and crash happens depending on clicking speed.
81
- //
82
- // If you want, turn this to true, just click slow :)
83
- //
84
- // While `useAnimatedUpdateForCollectionView` is false, you can click as fast as
85
- // you want, table view doesn't seem to have same issues like collection view.
86
-
87
- let useAnimatedUpdates = true
88
- if useAnimatedUpdates {
89
- let cvAnimatedDataSource = RxCollectionViewSectionedAnimatedDataSource < NumberSection > ( )
90
- skinCollectionViewDataSource ( cvAnimatedDataSource)
91
-
92
- randomSections
93
- . implicitTransaction ( )
94
- . bindTo ( animatedCollectionView. rx. items ( dataSource: cvAnimatedDataSource) )
95
- . addDisposableTo ( disposeBag)
96
- }
97
- else {
98
- let cvReloadDataSource = RxCollectionViewSectionedReloadDataSource < NumberSection > ( )
99
- skinCollectionViewDataSource ( cvReloadDataSource)
100
- randomSections
101
- . bindTo ( animatedCollectionView. rx. items ( dataSource: cvReloadDataSource) )
102
- . addDisposableTo ( disposeBag)
103
- }
61
+ let cvAnimatedDataSource = RxCollectionViewSectionedAnimatedDataSource < NumberSection > ( )
62
+ skinCollectionViewDataSource ( cvAnimatedDataSource)
63
+
64
+ randomSections
65
+ . bindTo ( animatedCollectionView. rx. items ( dataSource: cvAnimatedDataSource) )
66
+ . addDisposableTo ( disposeBag)
104
67
105
68
// touches
106
69
0 commit comments