Skip to content

Commit

Permalink
Round-trip toll collection name
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed May 6, 2022
1 parent d832ca1 commit 0318e2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/MapboxDirections/TollCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ public struct TollCollection: Codable, Equatable, ForeignMemberContainer {
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
type = try container.decode(CollectionType.self, forKey: .type)
name = try container.decodeIfPresent(String.self, forKey: .name)

try decodeForeignMembers(notKeyedBy: CodingKeys.self, with: decoder)
}

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(type, forKey: .type)
try container.encodeIfPresent(name, forKey: .name)

try encodeForeignMembers(notKeyedBy: CodingKeys.self, to: encoder)
}
Expand Down

0 comments on commit 0318e2e

Please sign in to comment.