2017-10-08 06:41:21 +02:00
|
|
|
//
|
|
|
|
// 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 {
|
|
|
|
|
2017-10-09 03:58:15 +02:00
|
|
|
public var account: Account? {
|
2017-10-08 06:41:21 +02:00
|
|
|
get {
|
|
|
|
return AccountManager.shared.existingAccount(with: accountID)
|
|
|
|
}
|
|
|
|
}
|
2017-10-09 03:58:15 +02:00
|
|
|
|
|
|
|
public func fetchArticles() -> Set<Article> {
|
|
|
|
|
|
|
|
guard let account = account else {
|
|
|
|
assertionFailure("Expected feed.account.")
|
|
|
|
return Set<Article>()
|
|
|
|
}
|
|
|
|
return account.fetchArticles(for: self)
|
|
|
|
}
|
2017-10-08 06:41:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public extension Article {
|
|
|
|
|
2017-10-09 07:25:33 +02:00
|
|
|
public var account: Account? {
|
2017-10-08 06:41:21 +02:00
|
|
|
get {
|
|
|
|
return AccountManager.shared.existingAccount(with: accountID)
|
|
|
|
}
|
|
|
|
}
|
2017-10-09 07:25:33 +02:00
|
|
|
|
|
|
|
public var feed: Feed? {
|
|
|
|
get {
|
|
|
|
return account?.existingFeed(with: feedID)
|
|
|
|
}
|
|
|
|
}
|
2017-10-08 06:41:21 +02:00
|
|
|
}
|
2017-10-10 22:23:12 +02:00
|
|
|
|