2019-11-10-tanabe
これはDataからDecodableに準拠した型,selfを渡す
使用例
コードがprivateじゃないから実装を真似できない
code:swift
.map { $0.data }
.decode(type: DecodableExample.self, decoder: JSONDecoder())
code:swift
extension Publisher {
/// Decodes the output from upstream using a specified TopLevelDecoder.
/// For example, use JSONDecoder.
public func decode<Item, Coder>(type: Item.Type, decoder: Coder) -> Publishers.Decode<Self, Item, Coder> where Item : Decodable, Coder : TopLevelDecoder, Self.Output == Coder.Input
}
Combineに苦戦中
できた
custom Publisherを定義してextensionでメソッドを実行してやれば同じことができる
テストまだなのでissueにする