ForeignMemberContainerClass
A class that can contain foreign members in arbitrary keys.
When subclassing ForeignMemberContainerClass
type, you should call decodeForeignMembers(notKeyedBy:with:)
during your Decodable.init(from:)
initializer if your subclass has added any new properties.
Structures should conform to the ForeignMemberContainer
protocol instead of this protocol.
-
Foreign members to round-trip to JSON.
Foreign members are unrecognized properties, similar to foreign members in GeoJSON. This library does not officially support any property that is documented as a “beta” property in the Mapbox Directions API response format, but you can get and set it as an element of this
JSONObject
. -
decodeForeignMembers(notKeyedBy:with:)
Default implementationDecodes any foreign members using the given decoder.
Default Implementation
-
encodeForeignMembers(to:)
Default implementationEncodes any foreign members using the given encoder.
This method should be called in your
Encodable.encode(to:)
implementation only in the base class. Otherwise it will not encodeforeignMembers
or way overwrite it.Default Implementation