NetNewsWire/Frameworks/Account/DataExtensions.swift

38 lines
669 B
Swift
Raw Normal View History

//
// DataExtensions.swift
// Account
//
// Created by Brent Simmons on 10/7/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
//
import Foundation
import Data
public extension Feed {
public var account: Account? {
get {
return AccountManager.shared.existingAccount(with: accountID)
}
}
public func fetchArticles() -> Set<Article> {
guard let account = account else {
assertionFailure("Expected feed.account.")
return Set<Article>()
}
return account.fetchArticles(for: self)
}
}
public extension Article {
var account: Account? {
get {
return AccountManager.shared.existingAccount(with: accountID)
}
}
}