Skip to content
This repository was archived by the owner on Jun 17, 2023. It is now read-only.

Commit 03ada05

Browse files
authored
Fix/samples issues (#64)
* Set target to iOS 13 * Fix sample issues * Revert min ios to 10
1 parent 1b2fc00 commit 03ada05

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Samples/PagingLayoutSamples/Modules/UIKit/Cards/CardsViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ class CardsViewController: UIViewController, NibBased, ViewModelBased {
4646
super.viewDidLayoutSubviews()
4747
layout.invalidateLayoutInBatchUpdate()
4848
if !didScrollCollectionViewToMiddle {
49-
layout.setCurrentPage(Constants.infiniteNumberOfItems / 2, animated: false)
5049
didScrollCollectionViewToMiddle = true
50+
collectionView?.performBatchUpdates({ [weak self] in
51+
self?.layout.setCurrentPage(Constants.infiniteNumberOfItems / 2, animated: false)
52+
})
5153
}
5254
}
5355

Samples/PagingLayoutSamples/Modules/UIKit/Shapes/ShapesViewController.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ class ShapesViewController: UIViewController, NibBased, ViewModelBased {
5454
super.viewDidLayoutSubviews()
5555

5656
if !didScrollCollectionViewToMiddle {
57-
getPagingLayout(layoutTypeCollectionView)?.setCurrentPage(
58-
Constants.infiniteNumberOfItems / 2,
59-
animated: false
60-
)
6157
didScrollCollectionViewToMiddle = true
58+
collectionView?.performBatchUpdates({ [weak self] in
59+
self?.getPagingLayout(layoutTypeCollectionView)?.setCurrentPage(
60+
Constants.infiniteNumberOfItems / 2,
61+
animated: false
62+
)
63+
})
6264
}
6365

6466
updateSelectedLayout()
@@ -240,7 +242,11 @@ extension ShapesViewController: UICollectionViewDelegate {
240242
}
241243

242244
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
243-
(collectionView.collectionViewLayout as? CollectionViewPagingLayout)?.setCurrentPage(indexPath.row)
245+
(collectionView.collectionViewLayout as? CollectionViewPagingLayout)?.setCurrentPage(indexPath.row) { [weak self] in
246+
DispatchQueue.main.async {
247+
self?.updateSelectedLayout()
248+
}
249+
}
244250
}
245251
}
246252

0 commit comments

Comments
 (0)