Skip to content

Commit 0f154b0

Browse files
author
Clément Le Provost
committed
Support Swift 2.3
1 parent dabd1cc commit 0f154b0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

AlgoliaSearch.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,11 @@
425425
};
426426
5DB2513C1AAD9EE300945339 = {
427427
CreatedOnToolsVersion = 6.1.1;
428+
LastSwiftMigration = 0800;
428429
};
429430
5DB251461AAD9EE400945339 = {
430431
CreatedOnToolsVersion = 6.1.1;
432+
LastSwiftMigration = 0800;
431433
};
432434
BCD1F5491CC61C8D0006E227 = {
433435
CreatedOnToolsVersion = 7.3;
@@ -796,6 +798,7 @@
796798
PRODUCT_NAME = AlgoliaSearch;
797799
SDKROOT = iphoneos;
798800
SKIP_INSTALL = YES;
801+
SWIFT_VERSION = 2.3;
799802
TARGETED_DEVICE_FAMILY = "1,2";
800803
};
801804
name = Debug;
@@ -817,6 +820,7 @@
817820
PRODUCT_NAME = AlgoliaSearch;
818821
SDKROOT = iphoneos;
819822
SKIP_INSTALL = YES;
823+
SWIFT_VERSION = 2.3;
820824
TARGETED_DEVICE_FAMILY = "1,2";
821825
VALIDATE_PRODUCT = YES;
822826
};
@@ -837,6 +841,7 @@
837841
PRODUCT_BUNDLE_IDENTIFIER = "com.algolia.$(PRODUCT_NAME:rfc1034identifier)";
838842
PRODUCT_NAME = "$(TARGET_NAME)";
839843
SDKROOT = iphoneos;
844+
SWIFT_VERSION = 2.3;
840845
};
841846
name = Debug;
842847
};
@@ -851,6 +856,7 @@
851856
PRODUCT_BUNDLE_IDENTIFIER = "com.algolia.$(PRODUCT_NAME:rfc1034identifier)";
852857
PRODUCT_NAME = "$(TARGET_NAME)";
853858
SDKROOT = iphoneos;
859+
SWIFT_VERSION = 2.3;
854860
VALIDATE_PRODUCT = YES;
855861
};
856862
name = Release;

Tests/MockURLSession.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ public class MockURLSession: URLSession {
6868
let defaultResponse = MockResponse(error: NSError(domain: NSURLErrorDomain, code: NSURLErrorResourceUnavailable, userInfo: nil))
6969

7070
public func dataTaskWithRequest(request: NSURLRequest, completionHandler: (NSData?, NSURLResponse?, NSError?) -> Void) -> NSURLSessionDataTask {
71+
#if swift(>=2.3)
72+
let details = responses[request.URL!.absoluteString!] ?? defaultResponse
73+
#else
7174
let details = responses[request.URL!.absoluteString] ?? defaultResponse
75+
#endif
7276
let task = MockURLSessionDataTask(request: request, details: details, completionHandler: completionHandler)
7377
task.cancellable = self.cancellable
7478
return task

0 commit comments

Comments
 (0)