diff --git a/Tuist/Interfaces/UIKit/Project/Podfile b/Tuist/Interfaces/UIKit/Project/Podfile index dee619b6..45221b74 100644 --- a/Tuist/Interfaces/UIKit/Project/Podfile +++ b/Tuist/Interfaces/UIKit/Project/Podfile @@ -5,8 +5,6 @@ inhibit_all_warnings! def testing_pods pod 'Quick' pod 'Nimble' - pod 'RxNimble', subspecs: ['RxBlocking', 'RxTest'] - pod 'RxSwift' pod 'Sourcery' pod 'SwiftFormat/CLI' end @@ -16,12 +14,6 @@ target '{PROJECT_NAME}' do pod 'Kingfisher' pod 'SnapKit' - # Rx - pod 'RxAlamofire' - pod 'RxCocoa' - pod 'RxDataSources' - pod 'RxSwift' - # Storage pod 'KeychainAccess' diff --git a/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift b/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift index c8be3e5b..fb6a161d 100644 --- a/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift +++ b/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift @@ -3,12 +3,14 @@ // import Alamofire -import RxAlamofire -import RxSwift +import Combine protocol NetworkAPIProtocol { - func performRequest(_ configuration: RequestConfiguration, for type: T.Type) -> Single + func performRequest( + _ configuration: RequestConfiguration, + for type: T.Type + ) -> AnyPublisher } extension NetworkAPIProtocol { @@ -17,28 +19,16 @@ extension NetworkAPIProtocol { session: Session, configuration: RequestConfiguration, decoder: JSONDecoder - ) -> Single { - return session.rx.request( - configuration.method, + ) -> AnyPublisher { + return session.request( configuration.url, + method: configuration.method, parameters: configuration.parameters, encoding: configuration.encoding, headers: configuration.headers, interceptor: configuration.interceptor ) - .responseData() - .flatMap { _, data -> Observable in - Observable.create { observer in - do { - let decodable = try decoder.decode(T.self, from: data) - observer.on(.next(decodable)) - } catch { - observer.on(.error(error)) - } - observer.on(.completed) - return Disposables.create() - } - } - .asSingle() + .publishDecodable(type: T.self, decoder: decoder) + .value() } } diff --git a/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/NetworkAPI.swift b/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/NetworkAPI.swift index a713490e..413a003c 100644 --- a/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/NetworkAPI.swift +++ b/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/NetworkAPI.swift @@ -3,8 +3,7 @@ // import Alamofire -import Foundation -import RxSwift +import Combine final class NetworkAPI: NetworkAPIProtocol { @@ -14,7 +13,10 @@ final class NetworkAPI: NetworkAPIProtocol { self.decoder = decoder } - func performRequest(_ configuration: RequestConfiguration, for type: T.Type) -> Single { + func performRequest( + _ configuration: RequestConfiguration, + for type: T.Type + ) -> AnyPublisher { request( session: Session(), configuration: configuration,