Skip to content

Commit

Permalink
Version 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanbruel committed Sep 11, 2017
1 parent b78ed79 commit ee75721
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions Moya-ObjectMapper.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Moya-ObjectMapper"
s.version = "2.3.2"
s.version = "2.4"
s.summary = "ObjectMapper bindings for Moya"
s.description = <<-EOS
[ObjectMapper](https://github.com/Hearst-DD/ObjectMapper) bindings for
Expand All @@ -22,7 +22,7 @@ Pod::Spec.new do |s|

s.subspec "Core" do |ss|
ss.source_files = "Source/*.swift"
ss.dependency "Moya", '~> 9.0'
ss.dependency "Moya", '~> 8.0'
ss.dependency "ObjectMapper", '~> 2.2'
ss.framework = "Foundation"
end
Expand All @@ -31,13 +31,14 @@ Pod::Spec.new do |s|
ss.source_files = "Source/RxSwift/*.swift"
ss.dependency "Moya/RxSwift"
ss.dependency "Moya-ObjectMapper/Core"
ss.dependency "RxSwift", '~> 3.1'
ss.dependency "RxSwift", '~> 3.3'
end

s.subspec "ReactiveSwift" do |ss|
ss.source_files = "Source/ReactiveSwift/*.swift"
ss.dependency "Moya/ReactiveSwift"
ss.dependency "Moya-ObjectMapper/Core"
ss.dependency "ReactiveSwift"
end
ss.dependency "Moya/ReactiveSwift"
ss.dependency "Moya-ObjectMapper/Core"
ss.dependency "ReactiveSwift"
end

end
4 changes: 2 additions & 2 deletions Source/ReactiveSwift/SignalProducer+ObjectMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extension SignalProducerProtocol where Value == Moya.Response, Error == MoyaErro

/// Maps data received from the signal into an object which implements the Mappable protocol.
/// If the conversion fails, the signal errors.
public func mapObject<T:BaseMappable>(_ type: T.Type, context: MapContext? = nil) -> SignalProducer<T, MoyaError> {
public func mapObject<T: BaseMappable>(_ type: T.Type, context: MapContext? = nil) -> SignalProducer<T, MoyaError> {
return producer.flatMap(.latest) {
(response: Response) -> SignalProducer<T, Error> in
return unwrapThrowable { try response.mapObject(type, context: context) }
Expand All @@ -17,7 +17,7 @@ extension SignalProducerProtocol where Value == Moya.Response, Error == MoyaErro
/// Maps data received from the signal into an array of objects which implement the Mappable
/// protocol.
/// If the conversion fails, the signal errors.
public func mapArray<T:BaseMappable>(_ type: T.Type, context: MapContext? = nil) -> SignalProducer<[T], MoyaError> {
public func mapArray<T: BaseMappable>(_ type: T.Type, context: MapContext? = nil) -> SignalProducer<[T], MoyaError> {
return producer.flatMap(.latest) { (response: Response) -> SignalProducer<[T], Error> in
return unwrapThrowable { try response.mapArray(type, context: context) }
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Response+ObjectMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public extension Response {
/// protocol.
/// If the conversion fails, the signal errors.
public func mapObject<T: ImmutableMappable>(_ type: T.Type, context: MapContext? = nil) throws -> T {
return try Mapper<T>(context: context).map(JSONObject: try mapJSON())
return try Mapper<T>(context: context).map(JSONObject: try mapJSON())
}

/// Maps data received from the signal into an array of objects which implement the ImmutableMappable
Expand All @@ -51,7 +51,7 @@ public extension Response {
guard let array = try mapJSON() as? [[String : Any]] else {
throw MoyaError.jsonMapping(self)
}
return try Mapper<T>(context: context).mapArray(JSONArray: array)
return try Mapper<T>(context: context).mapArray(JSONArray: array)
}

}

0 comments on commit ee75721

Please sign in to comment.