summaryrefslogtreecommitdiff
path: root/Sora/Data/ColumnsDataCache.swift
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-08-28 15:39:59 -0700
committerFuwn <[email protected]>2025-08-28 15:39:59 -0700
commitadd606fb0555a9a73f624e15e5fd916a49469ab8 (patch)
tree27ff8daf5e3fee1a97970ca9bc70f26ab690c570 /Sora/Data/ColumnsDataCache.swift
parentfeat: Development commit (diff)
downloadsora-testing-add606fb0555a9a73f624e15e5fd916a49469ab8.tar.xz
sora-testing-add606fb0555a9a73f624e15e5fd916a49469ab8.zip
feat: Development commit
Diffstat (limited to 'Sora/Data/ColumnsDataCache.swift')
-rw-r--r--Sora/Data/ColumnsDataCache.swift14
1 files changed, 13 insertions, 1 deletions
diff --git a/Sora/Data/ColumnsDataCache.swift b/Sora/Data/ColumnsDataCache.swift
index 4858e80..bec37fb 100644
--- a/Sora/Data/ColumnsDataCache.swift
+++ b/Sora/Data/ColumnsDataCache.swift
@@ -1,5 +1,17 @@
-struct ColumnsDataCache {
+struct ColumnsDataCache: Equatable {
let data: [[BooruPost]]
let columnCount: Int
let posts: [BooruPost]
+
+ static func == (lhs: Self, rhs: Self) -> Bool {
+ guard lhs.columnCount == rhs.columnCount else { return false }
+ guard lhs.posts.count == rhs.posts.count else { return false }
+ guard !lhs.posts.isEmpty, !rhs.posts.isEmpty else {
+ return lhs.posts.isEmpty == rhs.posts.isEmpty
+ }
+ guard lhs.posts.first?.id == rhs.posts.first?.id else { return false }
+ guard lhs.posts.last?.id == rhs.posts.last?.id else { return false }
+
+ return true
+ }
}