aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models/NewsArticle.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-01-09 10:30:44 -0800
committerDustin Mierau <dustin@mierau.me>2024-01-09 10:30:44 -0800
commit382121de2e79303845331d699adcdd777f8f062a (patch)
tree83bab877069d3a0daddcb6c2a031400b99c60756 /Hotline/Models/NewsArticle.swift
parent0910d3380755d38a93e5b87a31ecf31f17d0bc58 (diff)
Split view in News saves position and hiding when an article isn't selected. Some code cleanup. Some plumbing for news posting though it's not hooked up yet.
Diffstat (limited to 'Hotline/Models/NewsArticle.swift')
-rw-r--r--Hotline/Models/NewsArticle.swift21
1 files changed, 21 insertions, 0 deletions
diff --git a/Hotline/Models/NewsArticle.swift b/Hotline/Models/NewsArticle.swift
new file mode 100644
index 0000000..067d6b6
--- /dev/null
+++ b/Hotline/Models/NewsArticle.swift
@@ -0,0 +1,21 @@
+import Foundation
+
+struct NewsArticle: Identifiable, Codable {
+ var id: UUID = UUID()
+ var parentID: UInt32?
+ var path: [String]
+ var title: String
+ var body: String
+}
+
+extension NewsArticle: Equatable {
+ static func == (lhs: NewsArticle, rhs: NewsArticle) -> Bool {
+ return lhs.id == rhs.id && lhs.parentID == rhs.parentID
+ }
+}
+
+extension NewsArticle: Hashable {
+ func hash(into hasher: inout Hasher) {
+ hasher.combine(self.id)
+ }
+}