Show max. 10 items in history (IOS-141)
This commit is contained in:
parent
7abc536d01
commit
ed5a0f3abc
|
@ -53,10 +53,12 @@ extension SearchHistoryViewModel {
|
|||
|
||||
return users + hashtags
|
||||
}
|
||||
|
||||
let mostRecentItems = Array(items.prefix(10))
|
||||
var snapshot = NSDiffableDataSourceSnapshot<SearchHistorySection, SearchHistoryItem>()
|
||||
snapshot.appendSections([.main])
|
||||
snapshot.appendItems(items, toSection: .main)
|
||||
await diffableDataSource.apply(snapshot, animatingDifferences: false)
|
||||
snapshot.appendItems(mostRecentItems, toSection: .main)
|
||||
await diffableDataSource.apply(snapshot, animatingDifferences: true)
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue