Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit bfef81c

Browse files
committed
Update to Swift 3.0
1 parent 6efca19 commit bfef81c

16 files changed

+357
-336
lines changed

Diff for: .travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: objective-c
2-
osx_image: xcode8.0
2+
osx_image: xcode8
33
script:
4+
- cd URITemplate && swift package generate-xcodeproj
45
- xcodebuild -project Mockingjay.xcodeproj -scheme Mockingjay test -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty
56
- pod lib lint --quick

Diff for: Mockingjay.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Pod::Spec.new do |spec|
1212
spec.requires_arc = true
1313

1414
spec.subspec 'Core' do |core_spec|
15-
core_spec.dependency 'URITemplate', '~> 1.3'
15+
core_spec.dependency 'URITemplate', '~> 2.0'
1616
core_spec.source_files = 'Mockingjay/Mockingjay.{h,swift}',
1717
'Mockingjay/MockingjayProtocol.swift',
1818
'Mockingjay/{Matchers,Builders}.swift',

Diff for: Mockingjay.xcodeproj/project.pbxproj

+64-36
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
/* Begin PBXBuildFile section */
1010
2705946B1C4FA7A6002A3AA9 /* MockingjayXCTestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2705946A1C4FA7A6002A3AA9 /* MockingjayXCTestTests.swift */; };
11+
2715FACF1D8C81AB00A89DF7 /* URITemplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2715FAC91D8C818C00A89DF7 /* URITemplate.framework */; };
1112
274367921AA27A7C0030C97B /* Mockingjay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367911AA27A7C0030C97B /* Mockingjay.swift */; };
1213
274367941AA27AAD0030C97B /* MockingjayProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367931AA27AAD0030C97B /* MockingjayProtocol.swift */; };
1314
274367961AA27B170030C97B /* MockingjayProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367951AA27B170030C97B /* MockingjayProtocolTests.swift */; };
1415
274367981AA28AFC0030C97B /* Matchers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367971AA28AFC0030C97B /* Matchers.swift */; };
1516
2743679A1AA28B0D0030C97B /* MatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367991AA28B0D0030C97B /* MatcherTests.swift */; };
16-
274367AE1AA29AED0030C97B /* URITemplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 274367A91AA29ADA0030C97B /* URITemplate.framework */; };
1717
274367B01AA29E510030C97B /* Builders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367AF1AA29E510030C97B /* Builders.swift */; };
1818
274367B21AA29E620030C97B /* BuildersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367B11AA29E620030C97B /* BuildersTests.swift */; };
1919
274367C61AA35FD00030C97B /* NSURLSessionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367C51AA35FD00030C97B /* NSURLSessionConfiguration.swift */; };
@@ -27,27 +27,34 @@
2727
/* End PBXBuildFile section */
2828

2929
/* Begin PBXContainerItemProxy section */
30-
274367A81AA29ADA0030C97B /* PBXContainerItemProxy */ = {
30+
2715FAC41D8C818C00A89DF7 /* PBXContainerItemProxy */ = {
3131
isa = PBXContainerItemProxy;
32-
containerPortal = 274367A31AA29ADA0030C97B /* URITemplate.xcodeproj */;
32+
containerPortal = 2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */;
3333
proxyType = 2;
34-
remoteGlobalIDString = 77356D801A253325002822CF;
35-
remoteInfo = URITemplate;
34+
remoteGlobalIDString = "_____Product_Spectre";
35+
remoteInfo = Spectre;
3636
};
37-
274367AA1AA29ADA0030C97B /* PBXContainerItemProxy */ = {
37+
2715FAC61D8C818C00A89DF7 /* PBXContainerItemProxy */ = {
3838
isa = PBXContainerItemProxy;
39-
containerPortal = 274367A31AA29ADA0030C97B /* URITemplate.xcodeproj */;
39+
containerPortal = 2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */;
4040
proxyType = 2;
41-
remoteGlobalIDString = 77356D8B1A253325002822CF;
42-
remoteInfo = URITemplateTests;
41+
remoteGlobalIDString = "_____Product_PathKit";
42+
remoteInfo = PathKit;
4343
};
44-
274367AC1AA29AE70030C97B /* PBXContainerItemProxy */ = {
44+
2715FAC81D8C818C00A89DF7 /* PBXContainerItemProxy */ = {
4545
isa = PBXContainerItemProxy;
46-
containerPortal = 274367A31AA29ADA0030C97B /* URITemplate.xcodeproj */;
47-
proxyType = 1;
48-
remoteGlobalIDString = 77356D7F1A253325002822CF;
46+
containerPortal = 2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */;
47+
proxyType = 2;
48+
remoteGlobalIDString = "_____Product_URITemplate";
4949
remoteInfo = URITemplate;
5050
};
51+
2715FACA1D8C818C00A89DF7 /* PBXContainerItemProxy */ = {
52+
isa = PBXContainerItemProxy;
53+
containerPortal = 2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */;
54+
proxyType = 2;
55+
remoteGlobalIDString = "_____Product_URITemplateTests";
56+
remoteInfo = URITemplateTests;
57+
};
5158
2746CDCC1A702F7800719B66 /* PBXContainerItemProxy */ = {
5259
isa = PBXContainerItemProxy;
5360
containerPortal = 2746CDB61A702F7800719B66 /* Project object */;
@@ -59,13 +66,13 @@
5966

6067
/* Begin PBXFileReference section */
6168
2705946A1C4FA7A6002A3AA9 /* MockingjayXCTestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockingjayXCTestTests.swift; sourceTree = "<group>"; };
69+
2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = URITemplate.xcodeproj; path = URITemplate/URITemplate.xcodeproj; sourceTree = "<group>"; };
6270
274367911AA27A7C0030C97B /* Mockingjay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mockingjay.swift; sourceTree = "<group>"; };
6371
274367931AA27AAD0030C97B /* MockingjayProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockingjayProtocol.swift; sourceTree = "<group>"; };
6472
274367951AA27B170030C97B /* MockingjayProtocolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockingjayProtocolTests.swift; sourceTree = "<group>"; };
6573
274367971AA28AFC0030C97B /* Matchers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matchers.swift; sourceTree = "<group>"; };
6674
274367991AA28B0D0030C97B /* MatcherTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MatcherTests.swift; sourceTree = "<group>"; };
6775
2743679B1AA28D4D0030C97B /* XCTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTest.swift; sourceTree = "<group>"; };
68-
274367A31AA29ADA0030C97B /* URITemplate.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = URITemplate.xcodeproj; path = URITemplate/URITemplate.xcodeproj; sourceTree = "<group>"; };
6976
274367AF1AA29E510030C97B /* Builders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Builders.swift; sourceTree = "<group>"; };
7077
274367B11AA29E620030C97B /* BuildersTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildersTests.swift; sourceTree = "<group>"; };
7178
274367C51AA35FD00030C97B /* NSURLSessionConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSURLSessionConfiguration.swift; sourceTree = "<group>"; };
@@ -88,7 +95,7 @@
8895
isa = PBXFrameworksBuildPhase;
8996
buildActionMask = 2147483647;
9097
files = (
91-
274367AE1AA29AED0030C97B /* URITemplate.framework in Frameworks */,
98+
2715FACF1D8C81AB00A89DF7 /* URITemplate.framework in Frameworks */,
9299
);
93100
runOnlyForDeploymentPostprocessing = 0;
94101
};
@@ -103,19 +110,21 @@
103110
/* End PBXFrameworksBuildPhase section */
104111

105112
/* Begin PBXGroup section */
106-
274367A41AA29ADA0030C97B /* Products */ = {
113+
2715FABE1D8C818C00A89DF7 /* Products */ = {
107114
isa = PBXGroup;
108115
children = (
109-
274367A91AA29ADA0030C97B /* URITemplate.framework */,
110-
274367AB1AA29ADA0030C97B /* URITemplateTests.xctest */,
116+
2715FAC51D8C818C00A89DF7 /* Spectre.framework */,
117+
2715FAC71D8C818C00A89DF7 /* PathKit.framework */,
118+
2715FAC91D8C818C00A89DF7 /* URITemplate.framework */,
119+
2715FACB1D8C818C00A89DF7 /* URITemplateTests.xctest */,
111120
);
112121
name = Products;
113122
sourceTree = "<group>";
114123
};
115124
2746CDB51A702F7800719B66 = {
116125
isa = PBXGroup;
117126
children = (
118-
274367A31AA29ADA0030C97B /* URITemplate.xcodeproj */,
127+
2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */,
119128
2746CDDB1A702FC100719B66 /* Configurations */,
120129
2746CDC11A702F7800719B66 /* Mockingjay */,
121130
2746CDCE1A702F7800719B66 /* MockingjayTests */,
@@ -225,7 +234,6 @@
225234
buildRules = (
226235
);
227236
dependencies = (
228-
274367AD1AA29AE70030C97B /* PBXTargetDependency */,
229237
);
230238
name = Mockingjay;
231239
productName = Mockingjay;
@@ -258,7 +266,7 @@
258266
attributes = {
259267
LastSwiftMigration = 0700;
260268
LastSwiftUpdateCheck = 0730;
261-
LastUpgradeCheck = 0700;
269+
LastUpgradeCheck = 0800;
262270
ORGANIZATIONNAME = Cocode;
263271
TargetAttributes = {
264272
2746CDBE1A702F7800719B66 = {
@@ -283,8 +291,8 @@
283291
projectDirPath = "";
284292
projectReferences = (
285293
{
286-
ProductGroup = 274367A41AA29ADA0030C97B /* Products */;
287-
ProjectRef = 274367A31AA29ADA0030C97B /* URITemplate.xcodeproj */;
294+
ProductGroup = 2715FABE1D8C818C00A89DF7 /* Products */;
295+
ProjectRef = 2715FABD1D8C818C00A89DF7 /* URITemplate.xcodeproj */;
288296
},
289297
);
290298
projectRoot = "";
@@ -296,18 +304,32 @@
296304
/* End PBXProject section */
297305

298306
/* Begin PBXReferenceProxy section */
299-
274367A91AA29ADA0030C97B /* URITemplate.framework */ = {
307+
2715FAC51D8C818C00A89DF7 /* Spectre.framework */ = {
308+
isa = PBXReferenceProxy;
309+
fileType = wrapper.framework;
310+
path = Spectre.framework;
311+
remoteRef = 2715FAC41D8C818C00A89DF7 /* PBXContainerItemProxy */;
312+
sourceTree = BUILT_PRODUCTS_DIR;
313+
};
314+
2715FAC71D8C818C00A89DF7 /* PathKit.framework */ = {
315+
isa = PBXReferenceProxy;
316+
fileType = wrapper.framework;
317+
path = PathKit.framework;
318+
remoteRef = 2715FAC61D8C818C00A89DF7 /* PBXContainerItemProxy */;
319+
sourceTree = BUILT_PRODUCTS_DIR;
320+
};
321+
2715FAC91D8C818C00A89DF7 /* URITemplate.framework */ = {
300322
isa = PBXReferenceProxy;
301323
fileType = wrapper.framework;
302324
path = URITemplate.framework;
303-
remoteRef = 274367A81AA29ADA0030C97B /* PBXContainerItemProxy */;
325+
remoteRef = 2715FAC81D8C818C00A89DF7 /* PBXContainerItemProxy */;
304326
sourceTree = BUILT_PRODUCTS_DIR;
305327
};
306-
274367AB1AA29ADA0030C97B /* URITemplateTests.xctest */ = {
328+
2715FACB1D8C818C00A89DF7 /* URITemplateTests.xctest */ = {
307329
isa = PBXReferenceProxy;
308-
fileType = wrapper.cfbundle;
330+
fileType = file;
309331
path = URITemplateTests.xctest;
310-
remoteRef = 274367AA1AA29ADA0030C97B /* PBXContainerItemProxy */;
332+
remoteRef = 2715FACA1D8C818C00A89DF7 /* PBXContainerItemProxy */;
311333
sourceTree = BUILT_PRODUCTS_DIR;
312334
};
313335
/* End PBXReferenceProxy section */
@@ -361,11 +383,6 @@
361383
/* End PBXSourcesBuildPhase section */
362384

363385
/* Begin PBXTargetDependency section */
364-
274367AD1AA29AE70030C97B /* PBXTargetDependency */ = {
365-
isa = PBXTargetDependency;
366-
name = URITemplate;
367-
targetProxy = 274367AC1AA29AE70030C97B /* PBXContainerItemProxy */;
368-
};
369386
2746CDCD1A702F7800719B66 /* PBXTargetDependency */ = {
370387
isa = PBXTargetDependency;
371388
target = 2746CDBE1A702F7800719B66 /* Mockingjay */;
@@ -387,8 +404,10 @@
387404
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
388405
CLANG_WARN_EMPTY_BODY = YES;
389406
CLANG_WARN_ENUM_CONVERSION = YES;
407+
CLANG_WARN_INFINITE_RECURSION = YES;
390408
CLANG_WARN_INT_CONVERSION = YES;
391409
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
410+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
392411
CLANG_WARN_UNREACHABLE_CODE = YES;
393412
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
394413
COPY_PHASE_STRIP = NO;
@@ -397,6 +416,7 @@
397416
ENABLE_TESTABILITY = YES;
398417
GCC_C_LANGUAGE_STANDARD = gnu99;
399418
GCC_DYNAMIC_NO_PIC = NO;
419+
GCC_NO_COMMON_BLOCKS = YES;
400420
GCC_OPTIMIZATION_LEVEL = 0;
401421
GCC_PREPROCESSOR_DEFINITIONS = (
402422
"DEBUG=1",
@@ -409,7 +429,7 @@
409429
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
410430
GCC_WARN_UNUSED_FUNCTION = YES;
411431
GCC_WARN_UNUSED_VARIABLE = YES;
412-
MACOSX_DEPLOYMENT_TARGET = 10.9;
432+
MACOSX_DEPLOYMENT_TARGET = 10.10;
413433
MTL_ENABLE_DEBUG_INFO = YES;
414434
ONLY_ACTIVE_ARCH = YES;
415435
SDKROOT = macosx;
@@ -433,8 +453,10 @@
433453
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
434454
CLANG_WARN_EMPTY_BODY = YES;
435455
CLANG_WARN_ENUM_CONVERSION = YES;
456+
CLANG_WARN_INFINITE_RECURSION = YES;
436457
CLANG_WARN_INT_CONVERSION = YES;
437458
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
459+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
438460
CLANG_WARN_UNREACHABLE_CODE = YES;
439461
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
440462
COPY_PHASE_STRIP = YES;
@@ -443,16 +465,18 @@
443465
ENABLE_NS_ASSERTIONS = NO;
444466
ENABLE_STRICT_OBJC_MSGSEND = YES;
445467
GCC_C_LANGUAGE_STANDARD = gnu99;
468+
GCC_NO_COMMON_BLOCKS = YES;
446469
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
447470
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
448471
GCC_WARN_UNDECLARED_SELECTOR = YES;
449472
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
450473
GCC_WARN_UNUSED_FUNCTION = YES;
451474
GCC_WARN_UNUSED_VARIABLE = YES;
452-
MACOSX_DEPLOYMENT_TARGET = 10.9;
475+
MACOSX_DEPLOYMENT_TARGET = 10.10;
453476
MTL_ENABLE_DEBUG_INFO = NO;
454477
SDKROOT = macosx;
455-
SWIFT_VERSION = 2.3;
478+
SWIFT_VERSION = 3.0;
479+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
456480
VERSIONING_SYSTEM = "apple-generic";
457481
VERSION_INFO_PREFIX = "";
458482
};
@@ -482,6 +506,7 @@
482506
PRODUCT_NAME = "$(TARGET_NAME)";
483507
SKIP_INSTALL = YES;
484508
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
509+
SWIFT_VERSION = 3.0;
485510
WATCHOS_DEPLOYMENT_TARGET = 2.0;
486511
};
487512
name = Debug;
@@ -509,6 +534,7 @@
509534
PRODUCT_BUNDLE_IDENTIFIER = "org.cocode.$(PRODUCT_NAME:rfc1034identifier)";
510535
PRODUCT_NAME = "$(TARGET_NAME)";
511536
SKIP_INSTALL = YES;
537+
SWIFT_VERSION = 3.0;
512538
WATCHOS_DEPLOYMENT_TARGET = 2.0;
513539
};
514540
name = Release;
@@ -526,6 +552,7 @@
526552
INFOPLIST_FILE = MockingjayTests/Info.plist;
527553
PRODUCT_BUNDLE_IDENTIFIER = "org.cocode.$(PRODUCT_NAME:rfc1034identifier)";
528554
PRODUCT_NAME = "$(TARGET_NAME)";
555+
SWIFT_VERSION = 3.0;
529556
};
530557
name = Debug;
531558
};
@@ -538,6 +565,7 @@
538565
INFOPLIST_FILE = MockingjayTests/Info.plist;
539566
PRODUCT_BUNDLE_IDENTIFIER = "org.cocode.$(PRODUCT_NAME:rfc1034identifier)";
540567
PRODUCT_NAME = "$(TARGET_NAME)";
568+
SWIFT_VERSION = 3.0;
541569
};
542570
name = Release;
543571
};

Diff for: Mockingjay.xcodeproj/xcshareddata/xcschemes/Mockingjay.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Diff for: Mockingjay/Builders.swift

+15-15
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@ import Foundation
1111
// Collection of generic builders
1212

1313
/// Generic builder for returning a failure
14-
public func failure(error:NSError) -> (request:NSURLRequest) -> Response {
15-
return { _ in return .Failure(error) }
14+
public func failure(_ error: NSError) -> (_ request: URLRequest) -> Response {
15+
return { _ in return .failure(error) }
1616
}
1717

18-
public func http(status:Int = 200, headers:[String:String]? = nil, download:Download=nil) -> (request:NSURLRequest) -> Response {
19-
return { (request:NSURLRequest) in
20-
if let response = NSHTTPURLResponse(URL: request.URL!, statusCode: status, HTTPVersion: nil, headerFields: headers) {
21-
return Response.Success(response, download)
18+
public func http(_ status:Int = 200, headers:[String:String]? = nil, download:Download=nil) -> (_ request: URLRequest) -> Response {
19+
return { (request:URLRequest) in
20+
if let response = HTTPURLResponse(url: request.url!, statusCode: status, httpVersion: nil, headerFields: headers) {
21+
return Response.success(response, download)
2222
}
2323

24-
return .Failure(NSError(domain: NSInternalInconsistencyException, code: 0, userInfo: [NSLocalizedDescriptionKey: "Failed to construct response for stub."]))
24+
return .failure(NSError(domain: NSExceptionName.internalInconsistencyException.rawValue, code: 0, userInfo: [NSLocalizedDescriptionKey: "Failed to construct response for stub."]))
2525
}
2626
}
2727

28-
public func json(body:AnyObject, status:Int = 200, headers:[String:String]? = nil) -> (request:NSURLRequest) -> Response {
29-
return { (request:NSURLRequest) in
28+
public func json(_ body: Any, status:Int = 200, headers:[String:String]? = nil) -> (_ request: URLRequest) -> Response {
29+
return { (request:URLRequest) in
3030
do {
31-
let data = try NSJSONSerialization.dataWithJSONObject(body, options: NSJSONWritingOptions())
32-
return jsonData(data, status: status, headers: headers)(request: request)
31+
let data = try JSONSerialization.data(withJSONObject: body, options: JSONSerialization.WritingOptions())
32+
return jsonData(data, status: status, headers: headers)(request)
3333
} catch {
34-
return .Failure(error as NSError)
34+
return .failure(error as NSError)
3535
}
3636
}
3737
}
3838

39-
public func jsonData(data: NSData, status: Int = 200, headers: [String:String]? = nil) -> (request:NSURLRequest) -> Response {
40-
return { (request:NSURLRequest) in
39+
public func jsonData(_ data: Data, status: Int = 200, headers: [String:String]? = nil) -> (_ request: URLRequest) -> Response {
40+
return { (request:URLRequest) in
4141
var headers = headers ?? [String:String]()
4242
if headers["Content-Type"] == nil {
4343
headers["Content-Type"] = "application/json; charset=utf-8"
4444
}
4545

46-
return http(status, headers: headers, download: .Content(data))(request:request)
46+
return http(status, headers: headers, download: .content(data))(request)
4747
}
4848
}

0 commit comments

Comments
 (0)