From 863de80281f3a89d1dbafc2a39a99e7ed44ea0dc Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 10 Feb 2018 13:21:43 -0800 Subject: [PATCH] Add convenience method to Set
for just getting unread articles. --- Frameworks/Data/Article.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Frameworks/Data/Article.swift b/Frameworks/Data/Article.swift index 9e476f0ea..bee38db21 100644 --- a/Frameworks/Data/Article.swift +++ b/Frameworks/Data/Article.swift @@ -75,6 +75,12 @@ public extension Set where Element == Article { return Set(map { $0.articleID }) } + + public func unreadArticles() -> Set
{ + + let articles = self.filter { !$0.status.read } + return Set(articles) + } } public extension Array where Element == Article {