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
|
return users + hashtags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mostRecentItems = Array(items.prefix(10))
|
||||||
var snapshot = NSDiffableDataSourceSnapshot<SearchHistorySection, SearchHistoryItem>()
|
var snapshot = NSDiffableDataSourceSnapshot<SearchHistorySection, SearchHistoryItem>()
|
||||||
snapshot.appendSections([.main])
|
snapshot.appendSections([.main])
|
||||||
snapshot.appendItems(items, toSection: .main)
|
snapshot.appendItems(mostRecentItems, toSection: .main)
|
||||||
await diffableDataSource.apply(snapshot, animatingDifferences: false)
|
await diffableDataSource.apply(snapshot, animatingDifferences: true)
|
||||||
} catch {
|
} catch {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue