Skip to content

Commit

Permalink
Merge pull request tristanhimmelman#288 from ozgur/master
Browse files Browse the repository at this point in the history
Made compatible with Alamofire 5.0.0-rc2
  • Loading branch information
tristanhimmelman authored Oct 6, 2019
2 parents 9411d27 + 4083eb0 commit 029a1ac
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode10
osx_image: xcode10.3

env:
global:
Expand All @@ -12,12 +12,12 @@ env:
- SCHEME="AlamofireObjectMapper tvOS"

before_install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-document --quiet

script:
- set -o pipefail
- xcodebuild -workspace "$XCODE_WORKSPACE" -scheme "$SCHEME" -configuration Debug clean build CODE_SIGN_IDENTITY="" BITCODE_GENERATION_MODE=marker CODE_SIGNING_REQUIRED=NO | xcpretty -c;
- xcodebuild -workspace "$XCODE_WORKSPACE" -scheme "$SCHEME" -configuration Release clean build CODE_SIGN_IDENTITY="" BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO | xcpretty -c;

notifications:
email: false
email: false
6 changes: 3 additions & 3 deletions AlamofireObjectMapper.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Pod::Spec.new do |s|
s.watchos.deployment_target = '3.0'
s.tvos.deployment_target = '10.0'

s.swift_version = '4.2'
s.swift_version = '5.0'

s.requires_arc = true
s.source_files = 'AlamofireObjectMapper/**/*.swift'
s.dependency 'Alamofire', '5.0.0-beta.6'
s.dependency 'ObjectMapper', '~> 3.4'
s.dependency 'Alamofire', '5.0.0-rc.2'
s.dependency 'ObjectMapper', '~> 3.5.1'
end
32 changes: 16 additions & 16 deletions AlamofireObjectMapper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -893,7 +893,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -921,7 +921,7 @@
PRODUCT_NAME = AlamofireObjectMapper;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -945,7 +945,7 @@
PRODUCT_NAME = AlamofireObjectMapper;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -966,7 +966,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.tristanhimmelman.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -984,7 +984,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -1013,7 +1013,7 @@
PRODUCT_NAME = AlamofireObjectMapper;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1038,7 +1038,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1061,7 +1061,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.tristanhimmelman.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1080,7 +1080,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1105,7 +1105,7 @@
PRODUCT_NAME = AlamofireObjectMapper;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -1132,7 +1132,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -1159,7 +1159,7 @@
PRODUCT_NAME = AlamofireObjectMapper;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand All @@ -1186,7 +1186,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand All @@ -1205,7 +1205,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.tristanhimmelman.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
Expand All @@ -1223,7 +1223,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
Expand Down
12 changes: 6 additions & 6 deletions AlamofireObjectMapper/AlamofireObjectMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extension DataRequest {
let JSONObject = processResponse(request: request, response: response, data: data, keyPath: keyPath)

if let JSONObject = JSONObject,
let parsedObject = (try? Mapper<T>(context: context, shouldIncludeNilValues: false).map(JSONObject: JSONObject)){
let parsedObject = (try? Mapper<T>(context: context, shouldIncludeNilValues: false).map(JSONObject: JSONObject) as T) {
return parsedObject
} else {
let failureReason = "ObjectMapper failed to serialize response."
Expand All @@ -129,12 +129,12 @@ extension DataRequest {
- returns: The request.
*/
@discardableResult
public func responseObject<T: BaseMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse<T>) -> Void) -> Self {
public func responseObject<T: BaseMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (AFDataResponse<T>) -> Void) -> Self {
return response(queue: queue, responseSerializer: DataRequest.ObjectMapperSerializer(keyPath, mapToObject: object, context: context), completionHandler: completionHandler)
}

@discardableResult
public func responseObject<T: ImmutableMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse<T>) -> Void) -> Self {
public func responseObject<T: ImmutableMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (AFDataResponse<T>) -> Void) -> Self {
return response(queue: queue, responseSerializer: DataRequest.ObjectMapperImmutableSerializer(keyPath, context: context), completionHandler: completionHandler)
}

Expand Down Expand Up @@ -165,7 +165,7 @@ extension DataRequest {

if let JSONObject = processResponse(request: request, response: response, data: data, keyPath: keyPath){

if let parsedObject = try? Mapper<T>(context: context, shouldIncludeNilValues: false).mapArray(JSONObject: JSONObject){
if let parsedObject = try? Mapper<T>(context: context, shouldIncludeNilValues: false).mapArray(JSONObject: JSONObject) as [T] {
return parsedObject
}
}
Expand All @@ -185,7 +185,7 @@ extension DataRequest {
- returns: The request.
*/
@discardableResult
public func responseArray<T: BaseMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse<[T]>) -> Void) -> Self {
public func responseArray<T: BaseMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, context: MapContext? = nil, completionHandler: @escaping (AFDataResponse<[T]>) -> Void) -> Self {
return response(queue: queue, responseSerializer: DataRequest.ObjectMapperArraySerializer(keyPath, context: context), completionHandler: completionHandler)
}

Expand All @@ -199,7 +199,7 @@ extension DataRequest {
- returns: The request.
*/
@discardableResult
public func responseArray<T: ImmutableMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse<[T]>) -> Void) -> Self {
public func responseArray<T: ImmutableMappable>(queue: DispatchQueue = .main, keyPath: String? = nil, context: MapContext? = nil, completionHandler: @escaping (AFDataResponse<[T]>) -> Void) -> Self {
return response(queue: queue, responseSerializer: DataRequest.ObjectMapperImmutableArraySerializer(keyPath, context: context), completionHandler: completionHandler)
}
}
Expand Down
36 changes: 18 additions & 18 deletions AlamofireObjectMapperTests/AlamofireObjectMapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/d8bb95982be8a11a2308e779bb9a9707ebe42ede/sample_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseObject { (response: DataResponse<WeatherResponse>) in
_ = AF.request(URL, method: .get).responseObject { (response: AFDataResponse<WeatherResponse>) in
expectation.fulfill()

let mappedObject = response.result.value
let mappedObject = response.value

XCTAssertNotNil(mappedObject, "Response should not be nil")
XCTAssertNotNil(mappedObject?.location, "Location should not be nil")
Expand All @@ -78,10 +78,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let weatherResponse = WeatherResponse()
weatherResponse.date = Date()

_ = Alamofire.request(URL, method: .get).responseObject(mapToObject: weatherResponse) { (response: DataResponse<WeatherResponse>) in
_ = AF.request(URL, method: .get).responseObject(mapToObject: weatherResponse) { (response: AFDataResponse<WeatherResponse>) in
expectation.fulfill()

let mappedObject = response.result.value
let mappedObject = response.value
print(weatherResponse)
XCTAssertNotNil(mappedObject, "Response should not be nil")
XCTAssertNotNil(mappedObject?.date, "Date should not be nil") // Date is not in JSON but should not be nil because we mapped onto an existing object with a date set
Expand All @@ -105,10 +105,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/2ee8f34d21e8febfdefb2b3a403f18a43818d70a/sample_keypath_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseObject(keyPath: "data") { (response: DataResponse<WeatherResponse>) in
_ = AF.request(URL, method: .get).responseObject(keyPath: "data") { (response: AFDataResponse<WeatherResponse>) in
expectation.fulfill()

let mappedObject = response.result.value
let mappedObject = response.value

XCTAssertNotNil(mappedObject, "Response should not be nil")
XCTAssertNotNil(mappedObject?.location, "Location should not be nil")
Expand All @@ -131,10 +131,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/97231a04e6e4970612efcc0b7e0c125a83e3de6e/sample_keypath_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseObject(keyPath: "response.data") { (response: DataResponse<WeatherResponse>) in
_ = AF.request(URL, method: .get).responseObject(keyPath: "response.data") { (response: AFDataResponse<WeatherResponse>) in
expectation.fulfill()

let mappedObject = response.result.value
let mappedObject = response.value

XCTAssertNotNil(mappedObject, "Response should not be nil")
XCTAssertNotNil(mappedObject?.location, "Location should not be nil")
Expand All @@ -157,10 +157,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/f583be1121dbc5e9b0381b3017718a70c31054f7/sample_array_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseArray { (response: DataResponse<[Forecast]>) in
_ = AF.request(URL, method: .get).responseArray { (response: AFDataResponse<[Forecast]>) in
expectation.fulfill()

let mappedArray = response.result.value
let mappedArray = response.value

XCTAssertNotNil(mappedArray, "Response should not be nil")

Expand All @@ -183,11 +183,11 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/d8bb95982be8a11a2308e779bb9a9707ebe42ede/sample_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseArray(keyPath: "three_day_forecast") { (response: DataResponse<[Forecast]>) in
_ = AF.request(URL, method: .get).responseArray(keyPath: "three_day_forecast") { (response: AFDataResponse<[Forecast]>) in

expectation.fulfill()

let mappedArray = response.result.value
let mappedArray = response.value

XCTAssertNotNil(mappedArray, "Response should not be nil")

Expand All @@ -208,11 +208,11 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/97231a04e6e4970612efcc0b7e0c125a83e3de6e/sample_keypath_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseArray(keyPath: "response.data.three_day_forecast") { (response: DataResponse<[Forecast]>) in
_ = AF.request(URL, method: .get).responseArray(keyPath: "response.data.three_day_forecast") { (response: AFDataResponse<[Forecast]>) in

expectation.fulfill()

let mappedArray = response.result.value
let mappedArray = response.value

XCTAssertNotNil(mappedArray, "Response should not be nil")

Expand All @@ -235,10 +235,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/d8bb95982be8a11a2308e779bb9a9707ebe42ede/sample_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseObject { (response: DataResponse<WeatherResponseImmutable>) in
_ = AF.request(URL, method: .get).responseObject { (response: AFDataResponse<WeatherResponseImmutable>) in
expectation.fulfill()

let mappedObject = response.result.value
let mappedObject = response.value

XCTAssertNotNil(mappedObject, "Response should not be nil")
XCTAssertNotNil(mappedObject?.location, "Location should not be nil")
Expand All @@ -261,10 +261,10 @@ class AlamofireObjectMapperTests: XCTestCase {
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/f583be1121dbc5e9b0381b3017718a70c31054f7/sample_array_json"
let expectation = self.expectation(description: "\(URL)")

_ = Alamofire.request(URL, method: .get).responseArray { (response: DataResponse<[ImmutableForecast]>) in
_ = AF.request(URL, method: .get).responseArray { (response: AFDataResponse<[ImmutableForecast]>) in
expectation.fulfill()

let mappedArray = response.result.value
let mappedArray = response.value

XCTAssertNotNil(mappedArray, "Response should not be nil")

Expand Down
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Alamofire/Alamofire" "5.0.0-beta.6"
github "tristanhimmelman/ObjectMapper" ~> 3.4
github "Alamofire/Alamofire" "5.0.0-rc.2"
github "tristanhimmelman/ObjectMapper" ~> 3.5.1
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Alamofire/Alamofire" "5.0.0-beta.6"
github "Alamofire/Alamofire" "5.0.0-rc.2"
github "tristanhimmelman/ObjectMapper" "3.5.1"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Alamofire
Submodule Alamofire updated 336 files

0 comments on commit 029a1ac

Please sign in to comment.