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.

  • Decodes 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 : CodingKey

    Parameters

    codingKeys

    CodingKeys type which describes all properties declared in current subclass.

    decoder

    Decoder instance, which perfroms the decoding process.

  • encodeForeignMembers(to:) Default implementation

    Encodes 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 encode foreignMembers or way overwrite it.

    Default Implementation

    Declaration

    Swift

    func encodeForeignMembers(to encoder: Encoder) throws

    Parameters

    encoder

    Encoder instance, performing the encoding process.