diff --git a/AltStore/News/NewsViewController.swift b/AltStore/News/NewsViewController.swift index b04f0af0..9e0ca0a3 100644 --- a/AltStore/News/NewsViewController.swift +++ b/AltStore/News/NewsViewController.swift @@ -55,8 +55,6 @@ class NewsViewController: UICollectionViewController self.prototypeCell.translatesAutoresizingMaskIntoConstraints = false self.prototypeCell.contentView.translatesAutoresizingMaskIntoConstraints = false - self.collectionView.contentInset.bottom = 20 - self.collectionView.dataSource = self.dataSource self.collectionView.prefetchDataSource = self.dataSource @@ -74,6 +72,18 @@ class NewsViewController: UICollectionViewController self.fetchSource() } + + override func viewWillLayoutSubviews() + { + super.viewWillLayoutSubviews() + + if self.collectionView.contentInset.bottom != 20 + { + // Triggers collection view update in iOS 13, which crashes if we do it in viewDidLoad() + // since the database might not be loaded yet. + self.collectionView.contentInset.bottom = 20 + } + } } private extension NewsViewController