NetNewsWire/Multiplatform/Shared/Timeline/TimelineItem.swift

45 lines
719 B
Swift
Raw Normal View History

2020-06-30 18:03:33 +02:00
//
// TimelineItem.swift
// NetNewsWire
//
// Created by Maurice Parker on 6/30/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
import Articles
2020-07-01 23:33:07 +02:00
enum TimelineItemStatus {
case showStar
case showUnread
case showNone
}
2020-06-30 18:03:33 +02:00
struct TimelineItem: Identifiable {
2020-07-01 18:13:11 +02:00
var article: Article
2020-06-30 18:03:33 +02:00
2020-07-01 18:13:11 +02:00
var id: String {
return article.articleID
}
2020-06-30 18:03:33 +02:00
2020-07-01 23:33:07 +02:00
var status: TimelineItemStatus {
if article.status.starred == true {
return .showStar
}
if article.status.read == false {
return .showUnread
}
return .showNone
}
2020-07-02 00:39:27 +02:00
var byline: String {
return article.byline()
}
var dateTimeString: String {
return ArticleStringFormatter.dateString(article.logicalDatePublished)
}
2020-06-30 18:03:33 +02:00
}