Create and use fetchUnsortedArticles(for:), which is common code that needed to be a separate function.
This commit is contained in:
parent
21f1863cd0
commit
9fea9c2d12
@ -641,6 +641,15 @@ private extension TimelineViewController {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let fetchedArticles = fetchUnsortedArticles(for: representedObjects)
|
||||||
|
let sortedArticles = Array(fetchedArticles).sortedByDate()
|
||||||
|
if articles != sortedArticles {
|
||||||
|
articles = sortedArticles
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fetchUnsortedArticles(for representedObjects: [Any]) -> Set<Article> {
|
||||||
|
|
||||||
var fetchedArticles = Set<Article>()
|
var fetchedArticles = Set<Article>()
|
||||||
|
|
||||||
for object in representedObjects {
|
for object in representedObjects {
|
||||||
@ -653,13 +662,9 @@ private extension TimelineViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let sortedArticles = Array(fetchedArticles).sortedByDate()
|
return fetchedArticles
|
||||||
if articles != sortedArticles {
|
|
||||||
articles = sortedArticles
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func fetchAndMergeArticles() {
|
func fetchAndMergeArticles() {
|
||||||
|
|
||||||
let selectedArticleIDs = selectedArticles.articleIDs()
|
let selectedArticleIDs = selectedArticles.articleIDs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user