Fix crash when selecting attachments on iOS 13
This commit is contained in:
parent
95ebca04d2
commit
3937dde2bf
|
@ -73,6 +73,10 @@ class AssetCollectionViewController: UICollectionViewController {
|
||||||
collectionView.register(UINib(nibName: "AssetCollectionViewCell", bundle: .main), forCellWithReuseIdentifier: reuseIdentifier)
|
collectionView.register(UINib(nibName: "AssetCollectionViewCell", bundle: .main), forCellWithReuseIdentifier: reuseIdentifier)
|
||||||
collectionView.register(UINib(nibName: "ShowCameraCollectionViewCell", bundle: .main), forCellWithReuseIdentifier: cameraReuseIdentifier)
|
collectionView.register(UINib(nibName: "ShowCameraCollectionViewCell", bundle: .main), forCellWithReuseIdentifier: cameraReuseIdentifier)
|
||||||
|
|
||||||
|
let scale = UIScreen.main.scale
|
||||||
|
let cellSize = flowLayout.itemSize
|
||||||
|
thumbnailSize = CGSize(width: cellSize.width * scale, height: cellSize.height * scale)
|
||||||
|
|
||||||
dataSource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, item) -> UICollectionViewCell? in
|
dataSource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, item) -> UICollectionViewCell? in
|
||||||
switch item {
|
switch item {
|
||||||
case .showCamera:
|
case .showCamera:
|
||||||
|
@ -133,14 +137,6 @@ class AssetCollectionViewController: UICollectionViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
|
||||||
super.viewWillAppear(animated)
|
|
||||||
|
|
||||||
let scale = UIScreen.main.scale
|
|
||||||
let cellSize = flowLayout.itemSize
|
|
||||||
thumbnailSize = CGSize(width: cellSize.width * scale, height: cellSize.height * scale)
|
|
||||||
}
|
|
||||||
|
|
||||||
open func fetchAssets(with options: PHFetchOptions) -> PHFetchResult<PHAsset> {
|
open func fetchAssets(with options: PHFetchOptions) -> PHFetchResult<PHAsset> {
|
||||||
return PHAsset.fetchAssets(with: options)
|
return PHAsset.fetchAssets(with: options)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue