From 1b917f6bedd4f9ceb824533ea3de422a0978acd6 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 1 May 2022 12:05:38 -0400 Subject: [PATCH] Fix saved hashtags not getting persisted --- Pachyderm/Sources/Pachyderm/Model/Hashtag.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Pachyderm/Sources/Pachyderm/Model/Hashtag.swift b/Pachyderm/Sources/Pachyderm/Model/Hashtag.swift index 184f522956..ff61dd361c 100644 --- a/Pachyderm/Sources/Pachyderm/Model/Hashtag.swift +++ b/Pachyderm/Sources/Pachyderm/Model/Hashtag.swift @@ -34,6 +34,13 @@ public class Hashtag: Codable { self.history = try container.decodeIfPresent([History].self, forKey: .history) } + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(name, forKey: .name) + try container.encode(url.absoluteString, forKey: .url) + try container.encodeIfPresent(history, forKey: .history) + } + private enum CodingKeys: String, CodingKey { case name case url