diff options
| author | Fuwn <[email protected]> | 2025-08-28 15:39:59 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-08-28 15:39:59 -0700 |
| commit | add606fb0555a9a73f624e15e5fd916a49469ab8 (patch) | |
| tree | 27ff8daf5e3fee1a97970ca9bc70f26ab690c570 /Sora/Data/ColumnsDataCache.swift | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-add606fb0555a9a73f624e15e5fd916a49469ab8.tar.xz sora-testing-add606fb0555a9a73f624e15e5fd916a49469ab8.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Data/ColumnsDataCache.swift')
| -rw-r--r-- | Sora/Data/ColumnsDataCache.swift | 14 |
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 + } } |