I created a model and used codable with it. I am currently using GMSPath to get path, but on adding to the model class, I get the error Type 'EstimateResponse' does not conform to protocol 'Decodable' and Type 'EstimateResponse' does not conform to protocol 'Encodable'
below is my Model
class EstimateResponse: Codable {
var path: GMSPath? // Set by Google directions API call
var destination: String?
var distance: String?
}
any help is appreciated
GMSPathhas anencodedPathproperty (which is a string), and it can also be initialised with an encoded path. You just need to encode yourGMSPathto its encoded path representation.Conform
EstimateResponsetoCodablewith explicit implementations: