Fix saved hashtags not getting persisted

This commit is contained in:
Shadowfacts 2022-05-01 12:05:38 -04:00
parent 514e569bd5
commit 1b917f6bed
1 changed files with 7 additions and 0 deletions

View File

@ -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