Fix saved hashtags not getting persisted
This commit is contained in:
parent
514e569bd5
commit
1b917f6bed
|
@ -34,6 +34,13 @@ public class Hashtag: Codable {
|
||||||
self.history = try container.decodeIfPresent([History].self, forKey: .history)
|
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 {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case name
|
case name
|
||||||
case url
|
case url
|
||||||
|
|
Loading…
Reference in New Issue