Remove computed properties from TimelineItem

This commit is contained in:
Maurice Parker 2020-07-17 20:55:18 -05:00
parent 2a4a13ed13
commit be60b112d0
1 changed files with 8 additions and 14 deletions

View File

@ -17,31 +17,25 @@ enum TimelineItemStatus {
struct TimelineItem: Identifiable { struct TimelineItem: Identifiable {
var id: String
var article: Article var article: Article
var status: TimelineItemStatus = .showNone
var truncatedTitle: String var truncatedTitle: String
var truncatedSummary: String var truncatedSummary: String
var byline: String
var dateTimeString: String
init(article: Article) { init(article: Article) {
self.id = article.articleID
self.article = article self.article = article
self.byline = article.webFeed?.nameForDisplay ?? ""
self.dateTimeString = ArticleStringFormatter.dateString(article.logicalDatePublished)
self.truncatedTitle = ArticleStringFormatter.truncatedTitle(article) self.truncatedTitle = ArticleStringFormatter.truncatedTitle(article)
self.truncatedSummary = ArticleStringFormatter.truncatedSummary(article) self.truncatedSummary = ArticleStringFormatter.truncatedSummary(article)
updateStatus() updateStatus()
} }
var id: String {
return article.articleID
}
var status: TimelineItemStatus = .showNone
var byline: String {
return article.webFeed?.nameForDisplay ?? ""
}
var dateTimeString: String {
return ArticleStringFormatter.dateString(article.logicalDatePublished)
}
mutating func updateStatus() { mutating func updateStatus() {
if article.status.starred == true { if article.status.starred == true {
status = .showStar status = .showStar