diff --git a/Moya-ObjectMapper.podspec b/Moya-ObjectMapper.podspec index 718f529b..53e39131 100755 --- a/Moya-ObjectMapper.podspec +++ b/Moya-ObjectMapper.podspec @@ -19,11 +19,11 @@ Pod::Spec.new do |s| s.tvos.deployment_target = '10.0' s.source = { :git => "https://github.com/bmoliveira/Moya-ObjectMapper.git", :tag => s.version } s.default_subspec = "Core" - s.swift_version = '5.0' + s.swift_version = '5' s.subspec "Core" do |ss| ss.source_files = "Source/Core/*.swift" - ss.dependency "Moya", '~> 14.0.0-beta.6' + ss.dependency "Moya" ss.dependency "ObjectMapper" ss.framework = "Foundation" end diff --git a/Sample/Podfile.lock b/Sample/Podfile.lock index 3442a75c..cafdb0c3 100644 --- a/Sample/Podfile.lock +++ b/Sample/Podfile.lock @@ -1,45 +1,45 @@ PODS: - - Alamofire (5.0.0-rc.3) - - Differentiator (4.0.1) - - Moya (14.0.0-beta.6): - - Moya/Core (= 14.0.0-beta.6) - - Moya-ObjectMapper (3.0): - - Moya-ObjectMapper/Core (= 3.0) - - Moya-ObjectMapper/Core (3.0): - - Moya (~> 14.0.0-beta.6) + - Alamofire (5.5.0) + - Differentiator (5.0.0) + - Moya (15.0.0): + - Moya/Core (= 15.0.0) + - Moya-ObjectMapper (2.9): + - Moya-ObjectMapper/Core (= 2.9) + - Moya-ObjectMapper/Core (2.9): + - Moya - ObjectMapper - - Moya-ObjectMapper/ReactiveSwift (3.0): + - Moya-ObjectMapper/ReactiveSwift (2.9): - Moya-ObjectMapper/Core - Moya/ReactiveSwift - ReactiveSwift - - Moya-ObjectMapper/RxSwift (3.0): + - Moya-ObjectMapper/RxSwift (2.9): - Moya-ObjectMapper/Core - Moya/RxSwift - RxSwift - - Moya/Core (14.0.0-beta.6): - - Alamofire (= 5.0.0-rc.3) - - Moya/ReactiveSwift (14.0.0-beta.6): + - Moya/Core (15.0.0): + - Alamofire (~> 5.0) + - Moya/ReactiveSwift (15.0.0): - Moya/Core - - ReactiveSwift (~> 6.0) - - Moya/RxSwift (14.0.0-beta.6): + - ReactiveSwift (~> 6.6.1) + - Moya/RxSwift (15.0.0): - Moya/Core - - RxSwift (~> 5.0) - - ObjectMapper (3.5.1) - - ReactiveCocoa (10.2.0): - - ReactiveSwift (~> 6.2) - - ReactiveSwift (6.2.0) - - RxAlertController (5.0.0): - - RxSwift (~> 5.0) - - RxCocoa (5.0.1): - - RxRelay (~> 5) - - RxSwift (~> 5) - - RxDataSources (4.0.1): - - Differentiator (~> 4.0) - - RxCocoa (~> 5.0) - - RxSwift (~> 5.0) - - RxRelay (5.0.1): - - RxSwift (~> 5) - - RxSwift (5.0.1) + - RxSwift (~> 6.0) + - ObjectMapper (4.2.0) + - ReactiveCocoa (11.2.2): + - ReactiveSwift (~> 6.6) + - ReactiveSwift (6.6.1) + - RxAlertController (6.0.1): + - RxSwift (~> 6.0) + - RxCocoa (6.2.0): + - RxRelay (= 6.2.0) + - RxSwift (= 6.2.0) + - RxDataSources (5.0.0): + - Differentiator (~> 5.0) + - RxCocoa (~> 6.0) + - RxSwift (~> 6.0) + - RxRelay (6.2.0): + - RxSwift (= 6.2.0) + - RxSwift (6.2.0) DEPENDENCIES: - Moya @@ -75,19 +75,19 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Alamofire: ca8c0de6906873be89d6deec5c8de279e00bf872 - Differentiator: 886080237d9f87f322641dedbc5be257061b0602 - Moya: d4821fbcb3e784f34d2f82869e6855057a0b85d1 - Moya-ObjectMapper: c17b20a2ff331643b04f55c8975883ca0e59824b - ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0 - ReactiveCocoa: a123c42f449c552460a4ee217dd49c76a17c8204 - ReactiveSwift: 3dc8800378110b13d40b46ab362afa9f6bcffc6c - RxAlertController: ef75925a2a002f0f1fd03378ddeceaa9c1c5558f - RxCocoa: e741b9749968e8a143e2b787f1dfbff2b63d0a5c - RxDataSources: efee07fa4de48477eca0a4611e6d11e2da9c1114 - RxRelay: 89d54507f4fd4d969e6ec1d4bd7f3673640b4640 - RxSwift: e2dc62b366a3adf6a0be44ba9f405efd4c94e0c4 + Alamofire: 1c4fb5369c3fe93d2857c780d8bbe09f06f97e7c + Differentiator: e8497ceab83c1b10ca233716d547b9af21b9344d + Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee + Moya-ObjectMapper: 5909e3ec892dc917dbbe4ffbfb444d4c1825062f + ObjectMapper: 1eb41f610210777375fa806bf161dc39fb832b81 + ReactiveCocoa: e539cd41c523c8c80851b88e9723235c933b024b + ReactiveSwift: fab34244ad908808dc822bae352a058c8837c4ca + RxAlertController: d47c016a597ce9f461044f307c34959b07c9e9ce + RxCocoa: 4baf94bb35f2c0ab31bc0cb9f1900155f646ba42 + RxDataSources: aa47cc1ed6c500fa0dfecac5c979b723542d79cf + RxRelay: e72dbfd157807478401ef1982e1c61c945c94b2f + RxSwift: d356ab7bee873611322f134c5f9ef379fa183d8f PODFILE CHECKSUM: a54ee9026cab0878d85c2ed1207e4e7c44ad070e -COCOAPODS: 1.8.4 +COCOAPODS: 1.11.2 diff --git a/Source/RxSwift/ObservableType+ObjectMapper.swift b/Source/RxSwift/ObservableType+ObjectMapper.swift index 3f83767a..52f49b36 100644 --- a/Source/RxSwift/ObservableType+ObjectMapper.swift +++ b/Source/RxSwift/ObservableType+ObjectMapper.swift @@ -11,82 +11,82 @@ import Moya import ObjectMapper /// Extension for processing Responses into Mappable objects through ObjectMapper -public extension ObservableType where E == Response { - - /// Maps data received from the signal into an object - /// which implements the Mappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, context: MapContext? = nil) -> Observable { - return flatMap { response -> Observable in - return Observable.just(try response.mapObject(type, context: context)) +public extension ObservableType where Element == Response { + + /// Maps data received from the signal into an object + /// which implements the Mappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapObject(_ type: T.Type, context: MapContext? = nil) -> Observable { + return flatMap { response -> Observable in + return Observable.just(try response.mapObject(type, context: context)) + } } - } - - /// Maps data received from the signal into an array of objects - /// which implement the Mappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, context: MapContext? = nil) -> Observable<[T]> { - return flatMap { response -> Observable<[T]> in - return Observable.just(try response.mapArray(type, context: context)) + + /// Maps data received from the signal into an array of objects + /// which implement the Mappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapArray(_ type: T.Type, context: MapContext? = nil) -> Observable<[T]> { + return flatMap { response -> Observable<[T]> in + return Observable.just(try response.mapArray(type, context: context)) + } } - } - - /// Maps data received from the signal into an object - /// which implements the Mappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable { - return flatMap { response -> Observable in - return Observable.just(try response.mapObject(T.self, atKeyPath: keyPath, context: context)) + + /// Maps data received from the signal into an object + /// which implements the Mappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable { + return flatMap { response -> Observable in + return Observable.just(try response.mapObject(T.self, atKeyPath: keyPath, context: context)) + } } - } - - /// Maps data received from the signal into an array of objects - /// which implement the Mappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable<[T]> { - return flatMap { response -> Observable<[T]> in - return Observable.just(try response.mapArray(T.self, atKeyPath: keyPath, context: context)) + + /// Maps data received from the signal into an array of objects + /// which implement the Mappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable<[T]> { + return flatMap { response -> Observable<[T]> in + return Observable.just(try response.mapArray(T.self, atKeyPath: keyPath, context: context)) + } } - } } // MARK: - ImmutableMappable -public extension ObservableType where E == Response { - - /// Maps data received from the signal into an object - /// which implements the ImmutableMappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, context: MapContext? = nil) -> Observable { - return flatMap { response -> Observable in - return Observable.just(try response.mapObject(type, context: context)) +public extension ObservableType where Element == Response { + + /// Maps data received from the signal into an object + /// which implements the ImmutableMappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapObject(_ type: T.Type, context: MapContext? = nil) -> Observable { + return flatMap { response -> Observable in + return Observable.just(try response.mapObject(type, context: context)) + } } - } - - /// Maps data received from the signal into an array of objects - /// which implement the ImmutableMappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, context: MapContext? = nil) -> Observable<[T]> { - return flatMap { response -> Observable<[T]> in - return Observable.just(try response.mapArray(type, context: context)) + + /// Maps data received from the signal into an array of objects + /// which implement the ImmutableMappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapArray(_ type: T.Type, context: MapContext? = nil) -> Observable<[T]> { + return flatMap { response -> Observable<[T]> in + return Observable.just(try response.mapArray(type, context: context)) + } } - } - - /// Maps data received from the signal into an object - /// which implements the ImmutableMappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable { - return flatMap { response -> Observable in - return Observable.just(try response.mapObject(T.self, atKeyPath: keyPath, context: context)) + + /// Maps data received from the signal into an object + /// which implements the ImmutableMappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable { + return flatMap { response -> Observable in + return Observable.just(try response.mapObject(T.self, atKeyPath: keyPath, context: context)) + } } - } - - /// Maps data received from the signal into an array of objects - /// which implement the ImmutableMappable protocol and returns the result back - /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable<[T]> { - return flatMap { response -> Observable<[T]> in - return Observable.just(try response.mapArray(T.self, atKeyPath: keyPath, context: context)) + + /// Maps data received from the signal into an array of objects + /// which implement the ImmutableMappable protocol and returns the result back + /// If the conversion fails, the signal errors. + func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Observable<[T]> { + return flatMap { response -> Observable<[T]> in + return Observable.just(try response.mapArray(T.self, atKeyPath: keyPath, context: context)) + } } - } } diff --git a/Source/RxSwift/Single+ObjectMapper.swift b/Source/RxSwift/Single+ObjectMapper.swift index 071227d2..809fba43 100755 --- a/Source/RxSwift/Single+ObjectMapper.swift +++ b/Source/RxSwift/Single+ObjectMapper.swift @@ -11,82 +11,82 @@ import Moya import ObjectMapper /// Extension for processing Responses into Mappable objects through ObjectMapper -public extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Response { - +public extension PrimitiveSequence where Trait == SingleTrait, Element == Response { + /// Maps data received from the signal into an object /// which implements the Mappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, context: MapContext? = nil) -> Single { + func mapObject(_ type: T.Type, context: MapContext? = nil) -> Single { return flatMap { response -> Single in - return Single.just(try response.mapObject(type, context: context)) - } + return Single.just(try response.mapObject(type, context: context)) + } } - + /// Maps data received from the signal into an array of objects /// which implement the Mappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, context: MapContext? = nil) -> Single<[T]> { + func mapArray(_ type: T.Type, context: MapContext? = nil) -> Single<[T]> { return flatMap { response -> Single<[T]> in - return Single.just(try response.mapArray(type, context: context)) - } + return Single.just(try response.mapArray(type, context: context)) + } } - + /// Maps data received from the signal into an object /// which implements the Mappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single { + func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single { return flatMap { response -> Single in - return Single.just(try response.mapObject(type, atKeyPath: keyPath, context: context)) - } + return Single.just(try response.mapObject(type, atKeyPath: keyPath, context: context)) + } } - + /// Maps data received from the signal into an array of objects /// which implement the Mappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single<[T]> { + func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single<[T]> { return flatMap { response -> Single<[T]> in - return Single.just(try response.mapArray(type, atKeyPath: keyPath, context: context)) - } + return Single.just(try response.mapArray(type, atKeyPath: keyPath, context: context)) + } } } // MARK: - ImmutableMappable -public extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Response { - +public extension PrimitiveSequence where Trait == SingleTrait, Element == Response { + /// Maps data received from the signal into an object /// which implements the ImmutableMappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, context: MapContext? = nil) -> Single { + func mapObject(_ type: T.Type, context: MapContext? = nil) -> Single { return flatMap { response -> Single in - return Single.just(try response.mapObject(type, context: context)) - } + return Single.just(try response.mapObject(type, context: context)) + } } - + /// Maps data received from the signal into an array of objects /// which implement the ImmutableMappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, context: MapContext? = nil) -> Single<[T]> { + func mapArray(_ type: T.Type, context: MapContext? = nil) -> Single<[T]> { return flatMap { response -> Single<[T]> in - return Single.just(try response.mapArray(type, context: context)) - } + return Single.just(try response.mapArray(type, context: context)) + } } - + /// Maps data received from the signal into an object /// which implements the ImmutableMappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single { + func mapObject(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single { return flatMap { response -> Single in - return Single.just(try response.mapObject(type, atKeyPath: keyPath, context: context)) - } + return Single.just(try response.mapObject(type, atKeyPath: keyPath, context: context)) + } } - + /// Maps data received from the signal into an array of objects /// which implement the ImmutableMappable protocol and returns the result back /// If the conversion fails, the signal errors. - public func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single<[T]> { + func mapArray(_ type: T.Type, atKeyPath keyPath: String, context: MapContext? = nil) -> Single<[T]> { return flatMap { response -> Single<[T]> in - return Single.just(try response.mapArray(type, atKeyPath: keyPath, context: context)) - } + return Single.just(try response.mapArray(type, atKeyPath: keyPath, context: context)) + } } }