Skip to content

Commit

Permalink
Merge pull request #37 from mdiep/xcode8-swift2.3
Browse files Browse the repository at this point in the history
Support Xcode 8/Swift 2.3
  • Loading branch information
mdiep authored Jul 24, 2016
2 parents 144c215 + d84cb4e commit 8e2dfe7
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 35 deletions.
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: objective-c
notifications:
email: false
osx_image: xcode7.3
before_install:
- brew update
- brew outdated carthage || brew upgrade carthage
Expand All @@ -13,7 +12,19 @@ matrix:
include:
- xcode_scheme: Tentacle-OSX
env: XCODE_ACTION=test
osx_image: xcode7.3
- xcode_scheme: Tentacle-iOS
env: XCODE_ACTION=test
osx_image: xcode7.3
- xcode_scheme: update-test-fixtures
env: XCODE_ACTION=build
osx_image: xcode7.3
- xcode_scheme: Tentacle-OSX
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode8
- xcode_scheme: Tentacle-iOS
env: XCODE_ACTION="build-for-testing test-without-building"
osx_image: xcode8
- xcode_scheme: update-test-fixtures
env: XCODE_ACTION=build
osx_image: xcode8
6 changes: 3 additions & 3 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "ReactiveCocoa/ReactiveCocoa" ~> 4.2.1
github "thoughtbot/Argo" ~> 3.0
github "thoughtbot/Curry" ~> 2.1
github "ReactiveCocoa/ReactiveCocoa" ~> 4.2.2
github "thoughtbot/Argo" ~> 3.0.3
github "thoughtbot/Curry" ~> 2.3.3
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "AliSoftware/OHHTTPStubs" ~> 5.0
github "AliSoftware/OHHTTPStubs" "4995ecd"
10 changes: 5 additions & 5 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github "thoughtbot/Argo" "v3.0.1"
github "thoughtbot/Curry" "v2.2.0"
github "AliSoftware/OHHTTPStubs" "5.0.0"
github "antitypical/Result" "2.1.1"
github "ReactiveCocoa/ReactiveCocoa" "v4.2.1"
github "thoughtbot/Argo" "v3.0.3"
github "thoughtbot/Curry" "v2.3.3"
github "AliSoftware/OHHTTPStubs" "4995ecd762abdd81227d14faf65fde003fbbe789"
github "antitypical/Result" "2.1.3"
github "ReactiveCocoa/ReactiveCocoa" "v4.2.2"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/OHHTTPStubs
Submodule OHHTTPStubs updated 136 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ReactiveCocoa
Submodule ReactiveCocoa updated 38 files
+1 −1 .gitmodules
+42 −0 .travis.yml
+1 −1 Cartfile
+3 −3 Cartfile.private
+4 −4 Cartfile.resolved
+1 −1 Carthage/Checkouts/Nimble
+1 −1 Carthage/Checkouts/Quick
+1 −1 Carthage/Checkouts/Result
+1 −1 Carthage/Checkouts/xcconfigs
+131 −0 Documentation/DocumentingCode.md
+25 −0 ReactiveCocoa.playground/Pages/Sandbox.xcplaygroundpage/Contents.swift
+3 −3 ReactiveCocoa.playground/Pages/SignalProducer.xcplaygroundpage/Contents.swift
+1 −0 ReactiveCocoa.playground/contents.xcplayground
+37 −28 ReactiveCocoa.xcodeproj/project.pbxproj
+32 −11 ReactiveCocoa/Swift/Action.swift
+20 −8 ReactiveCocoa/Swift/Atomic.swift
+13 −7 ReactiveCocoa/Swift/Bag.swift
+27 −7 ReactiveCocoa/Swift/CocoaAction.swift
+61 −15 ReactiveCocoa/Swift/Disposable.swift
+10 −4 ReactiveCocoa/Swift/DynamicProperty.swift
+27 −7 ReactiveCocoa/Swift/Event.swift
+27 −4 ReactiveCocoa/Swift/EventLogger.swift
+125 −111 ReactiveCocoa/Swift/Flatten.swift
+27 −7 ReactiveCocoa/Swift/FoundationExtensions.swift
+111 −35 ReactiveCocoa/Swift/ObjectiveCBridging.swift
+30 −8 ReactiveCocoa/Swift/Observer.swift
+128 −20 ReactiveCocoa/Swift/Property.swift
+142 −29 ReactiveCocoa/Swift/Scheduler.swift
+515 −216 ReactiveCocoa/Swift/Signal.swift
+818 −327 ReactiveCocoa/Swift/SignalProducer.swift
+5 −3 ReactiveCocoaTests/Swift/ActionSpec.swift
+24 −0 ReactiveCocoaTests/Swift/FlattenSpec.swift
+7 −5 ReactiveCocoaTests/Swift/PropertySpec.swift
+22 −12 ReactiveCocoaTests/Swift/SignalProducerLiftingSpec.swift
+61 −2 ReactiveCocoaTests/Swift/SignalProducerSpec.swift
+52 −9 ReactiveCocoaTests/Swift/SignalSpec.swift
+27 −0 ReactiveCocoaTests/Swift/TestError.swift
+6 −0 script/build
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Result
14 changes: 13 additions & 1 deletion Tentacle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -499,23 +499,28 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Matt Diephouse";
TargetAttributes = {
61377C6B1C8A2B2C0081FF24 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
6190817C1C8A2D2B001BE2F8 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
BE88E7F11C88C6B30034A112 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
};
BE88E7FB1C88C6B30034A112 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
};
BE88E8661C88F0990034A112 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -766,6 +771,7 @@
PRODUCT_NAME = Tentacle;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -794,6 +800,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.diephouse.matt.TentacleiOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down Expand Up @@ -841,6 +848,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -881,6 +889,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_VERSION = 2.3;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -924,6 +933,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.diephouse.matt.Tentacle;
PRODUCT_NAME = Tentacle;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand All @@ -946,6 +956,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.diephouse.matt.TentacleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand All @@ -970,6 +981,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.diephouse.matt.update-test-fixtures";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
25 changes: 18 additions & 7 deletions Tentacle/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,24 @@ extension NSURL {
let queryItems = [ ("page", page), ("per_page", pageSize) ]
.filter { _, value in value != nil }
.map { name, value in NSURLQueryItem(name: name, value: "\(value!)") }

let URL = NSURL(string: server.endpoint)!
.URLByAppendingPathComponent(endpoint.path)
.URLWithQueryItems(endpoint.queryItems)
.URLWithQueryItems(queryItems)

self.init(string: URL.absoluteString)!

#if swift(>=2.3)
let URL = NSURL(string: server.endpoint)!
.URLByAppendingPathComponent(endpoint.path)!
.URLWithQueryItems(endpoint.queryItems)
.URLWithQueryItems(queryItems)
#else
let URL = NSURL(string: server.endpoint)!
.URLByAppendingPathComponent(endpoint.path)
.URLWithQueryItems(endpoint.queryItems)
.URLWithQueryItems(queryItems)
#endif

#if swift(>=2.3)
self.init(string: URL.absoluteString!)!
#else
self.init(string: URL.absoluteString)!
#endif
}
}

Expand Down
8 changes: 6 additions & 2 deletions Tentacle/PullRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public struct PullRequest: Hashable, CustomStringConvertible {
}

public var description: String {
return URL.absoluteString
#if swift(>=2.3)
return URL.absoluteString!
#else
return URL.absoluteString
#endif
}
}

Expand All @@ -41,4 +45,4 @@ extension PullRequest: ResourceType {
<*> (j <| "patch_url" >>- toNSURL)

}
}
}
12 changes: 9 additions & 3 deletions Tentacle/Repository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ public struct Repository: Hashable, CustomStringConvertible {

/// The URL of the repository.
public var URL: NSURL {
return server.URL
.URLByAppendingPathComponent(owner)
.URLByAppendingPathComponent(name)
#if swift(>=2.3)
return server.URL
.URLByAppendingPathComponent(owner)!
.URLByAppendingPathComponent(name)!
#else
return server.URL
.URLByAppendingPathComponent(owner)
.URLByAppendingPathComponent(name)
#endif
}

public var hashValue: Int {
Expand Down
7 changes: 5 additions & 2 deletions script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ my ($WORKSPACE, $SCHEME, $ACTION) = @ARGV;

my $buildSettings = qx{xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -showBuildSettings};

my @args = ("-workspace", $WORKSPACE, "-scheme", $SCHEME, $ACTION, "CODE_SIGNING_REQUIRED=NO", "CODE_SIGN_IDENTITY=");
my @args = ("-workspace", $WORKSPACE, "-scheme", $SCHEME, split(/\s+/, $ACTION), "CODE_SIGNING_REQUIRED=NO", "CODE_SIGN_IDENTITY=");

unshift @args, "-sdk", "iphonesimulator" if $buildSettings =~ /\bPLATFORM_NAME = iphoneos/i;
if ($buildSettings =~ /\bPLATFORM_NAME = iphoneos/i) {
unshift @args, "-destination", "name=iPhone 6s";
unshift @args, "-sdk", "iphonesimulator";
}

print "xcodebuild @args\n";
exec("xcodebuild", @args);
12 changes: 10 additions & 2 deletions update-test-fixtures/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ let session = NSURLSession.sharedSession()
let result = SignalProducer<FixtureType, NSError>(values: Fixture.allFixtures)
.flatMap(.Concat) { fixture -> SignalProducer<(), NSError> in
let request = NSURLRequest.create(fixture.URL, nil, contentType: fixture.contentType)
let dataURL = baseURL.URLByAppendingPathComponent(fixture.dataFilename as String)
let responseURL = baseURL.URLByAppendingPathComponent(fixture.responseFilename as String)
#if swift(>=2.3)
let dataURL = baseURL.URLByAppendingPathComponent(fixture.dataFilename as String)!
#else
let dataURL = baseURL.URLByAppendingPathComponent(fixture.dataFilename as String)
#endif
#if swift(>=2.3)
let responseURL = baseURL.URLByAppendingPathComponent(fixture.responseFilename as String)!
#else
let responseURL = baseURL.URLByAppendingPathComponent(fixture.responseFilename as String)
#endif
let path = (dataURL.path! as NSString).stringByAbbreviatingWithTildeInPath
print("*** Downloading \(request.URL!)\n to \(path)")
return session
Expand Down

0 comments on commit 8e2dfe7

Please sign in to comment.