ForeignMemberContainerClass
public protocol ForeignMemberContainerClass : AnyObject
A GeoJSON 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.
-
decodeForeignMembers(notKeyedBy:with:)Default implementationDecodes any foreign members using the given decoder.
Default Implementation
Declaration
Swift
func decodeForeignMembers<WellKnownCodingKeys>(notKeyedBy codingKeys: WellKnownCodingKeys.Type, with decoder: Decoder) throws where WellKnownCodingKeys : CaseIterable, WellKnownCodingKeys : CodingKeyParameters
codingKeysCodingKeystype which describes all properties declared in current subclass.decoderDecoderinstance, which perfroms the decoding process. -
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 encodeforeignMembersor way overwrite it.Default Implementation
Declaration
Swift
func encodeForeignMembers(to encoder: Encoder) throwsParameters
encoderEncoderinstance, performing the encoding process.
Install in Dash
ForeignMemberContainerClass Protocol Reference