AnyCall.ResponseTypewas renamed toAnyCall.Parser. This does also affect all subtypes.
- use
AnyCall.Parserinstead ofAnyCall.ResponseType
Call.ResponseTypewas renamed toCall.Parser. This does also affect all subtypes.
- use
YourCall.Parserinstead ofYourCall.ResponseType
Previously, when you did not need anything after a successful response, typealias ResponseType = Data was used.
Now, you can use typealias Parser = NoContentParser to better indicate that the response does not matter.
Note, that the OutputType is changed to Void then!
Previously, String, Dictionary, Data did conform to ResponseParser.
This is no longer the case. Instead, there are dedicated ResponseParser types.
Swap types for the Parser typealias:
Data->DataResponseParserDictionary->DictionaryParserString->StringParser
static parsefunc changed to instance func.- Require empty initializer.
DataParserno longer defines itself as a defaultOutputType
- remove static keyword for
parse(data:encoding:)func - add
init() { /* your init code */ }to anyDataParsersubtype - use
YourParser().parse(data:encoding:)instead ofYourParser.parse(data:encoding:)
- everything for parsing now done via instance instead of statically
- remove static keyword for
parse(data:)func - use
YourParser().parse(data:)instead ofYourParser.parse(data:)
- removed
- stop letting your
OutputTypes conform to anyDataParsersubtype - let your
OutputTypeconform toDecodable - use an
typealias Parser = JSONParser<Type>
Example
// previously
struct City: JSONSelfDecodable {
// ...
}
struct CityCall: Call {
typealias ResponseType = City
// ....
}
// now
struct City: Decodable {
// ...
}
struct CityCall: Call {
typealias Parser = JSONParser<City>
// ...
}- removed
- use
JSONParser<[Element]>as theParserof a call instead of[Element]directly.
- everything for parsing now done via instance instead of statically
- remove static keyword for
parse(response:data:)func - use
YourParser().parse(response:data:)instead ofYourParser.parse(response:data:)
- everything for parsing now done via instance instead of statically
- use
StringConvertibleParser<YourType>().parseinstead ofStringConvertibleParser<YourType>.parse