Add convenience method to Set<Article> for just getting unread articles.

This commit is contained in:
Brent Simmons 2018-02-10 13:21:43 -08:00
parent f5bfadfb33
commit 863de80281
1 changed files with 6 additions and 0 deletions

View File

@ -75,6 +75,12 @@ public extension Set where Element == Article {
return Set<String>(map { $0.articleID })
}
public func unreadArticles() -> Set<Article> {
let articles = self.filter { !$0.status.read }
return Set(articles)
}
}
public extension Array where Element == Article {