Skip to content

Commit

Permalink
Merge pull request #43 from mdiep/swift3
Browse files Browse the repository at this point in the history
Upgrade to Swift 3
  • Loading branch information
mdiep authored Nov 6, 2016
2 parents a8537db + a9c718d commit ae68d95
Show file tree
Hide file tree
Showing 47 changed files with 663 additions and 592 deletions.
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "Carthage/Checkouts/Result"]
path = Carthage/Checkouts/Result
url = https://github.com/antitypical/Result.git
[submodule "Carthage/Checkouts/ReactiveCocoa"]
path = Carthage/Checkouts/ReactiveCocoa
url = https://github.com/ReactiveCocoa/ReactiveCocoa.git
[submodule "Carthage/Checkouts/Argo"]
path = Carthage/Checkouts/Argo
url = https://github.com/thoughtbot/Argo.git
Expand All @@ -13,3 +10,9 @@
[submodule "Carthage/Checkouts/OHHTTPStubs"]
path = Carthage/Checkouts/OHHTTPStubs
url = https://github.com/AliSoftware/OHHTTPStubs.git
[submodule "Carthage/Checkouts/ReactiveSwift"]
path = Carthage/Checkouts/ReactiveSwift
url = https://github.com/ReactiveCocoa/ReactiveSwift.git
[submodule "Carthage/Checkouts/Runes"]
path = Carthage/Checkouts/Runes
url = https://github.com/thoughtbot/Runes.git
9 changes: 0 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ script: script/cibuild "$TRAVIS_XCODE_WORKSPACE" "$TRAVIS_XCODE_SCHEME" "$XCODE_
xcode_workspace: Tentacle.xcworkspace
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
Expand Down
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.2
github "thoughtbot/Argo" ~> 3.0.3
github "thoughtbot/Curry" ~> 2.3.3
github "ReactiveCocoa/ReactiveSwift" "1.0.0-alpha.3"
github "thoughtbot/Argo" ~> 4.1
github "thoughtbot/Curry" ~> 3.0
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "AliSoftware/OHHTTPStubs" "4995ecd"
github "AliSoftware/OHHTTPStubs" "5.2.2-swift3"
11 changes: 6 additions & 5 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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"
github "thoughtbot/Curry" "v3.0.0"
github "AliSoftware/OHHTTPStubs" "5.2.2-swift3"
github "antitypical/Result" "3.0.0"
github "thoughtbot/Runes" "v4.0.1"
github "thoughtbot/Argo" "v4.1.0"
github "ReactiveCocoa/ReactiveSwift" "1.0.0-alpha.3"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Argo
Submodule Argo updated 110 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Curry
2 changes: 1 addition & 1 deletion Carthage/Checkouts/OHHTTPStubs
Submodule OHHTTPStubs updated 41 files
+93 −31 CHANGELOG.md
+6 −1 Examples/ObjC/OHHTTPStubsDemo.xcodeproj/project.pbxproj
+9 −9 Examples/ObjC/Podfile.lock
+0 −1 Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/NSMutableURLRequest+HTTPBodyTesting.h
+1 −0 Examples/ObjC/Pods/Headers/Private/OHHTTPStubs/NSURLRequest+HTTPBodyTesting.h
+0 −1 Examples/ObjC/Pods/Headers/Public/OHHTTPStubs/NSMutableURLRequest+HTTPBodyTesting.h
+1 −0 Examples/ObjC/Pods/Headers/Public/OHHTTPStubs/NSURLRequest+HTTPBodyTesting.h
+2 −2 Examples/ObjC/Pods/Local Podspecs/OHHTTPStubs.podspec.json
+9 −9 Examples/ObjC/Pods/Manifest.lock
+186 −174 Examples/ObjC/Pods/Pods.xcodeproj/project.pbxproj
+2 −0 Examples/ObjC/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo-acknowledgements.plist
+2 −8 Examples/ObjC/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo-resources.sh
+1 −0 Examples/ObjC/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo.debug.xcconfig
+1 −0 Examples/ObjC/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo.release.xcconfig
+1 −1 Examples/Swift/AppDelegate.swift
+31 −31 Examples/Swift/MainViewController.swift
+15 −2 Examples/Swift/OHHTTPStubsDemo.xcodeproj/project.pbxproj
+1 −1 Examples/Swift/OHHTTPStubsDemo.xcodeproj/xcshareddata/xcschemes/OHHTTPStubsDemo.xcscheme
+10 −10 Examples/Swift/Podfile.lock
+2 −2 Examples/Swift/Pods/Local Podspecs/OHHTTPStubs.podspec.json
+10 −10 Examples/Swift/Pods/Manifest.lock
+164 −150 Examples/Swift/Pods/Pods.xcodeproj/project.pbxproj
+1 −1 Examples/Swift/Pods/Target Support Files/OHHTTPStubs/Info.plist
+3 −1 Examples/Swift/Pods/Target Support Files/OHHTTPStubs/OHHTTPStubs-umbrella.h
+2 −0 Examples/Swift/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo-acknowledgements.plist
+2 −8 Examples/Swift/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo-resources.sh
+2 −0 Examples/Swift/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo-umbrella.h
+1 −0 Examples/Swift/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo.debug.xcconfig
+1 −0 Examples/Swift/Pods/Target Support Files/Pods-OHHTTPStubsDemo/Pods-OHHTTPStubsDemo.release.xcconfig
+1 −1 OHHTTPStubs.podspec
+21 −21 OHHTTPStubs/OHHTTPStubs.xcodeproj/project.pbxproj
+1 −1 OHHTTPStubs/OHHTTPStubs.xcodeproj/xcshareddata/xcschemes/OHHTTPStubs Mac Framework.xcscheme
+1 −1 OHHTTPStubs/OHHTTPStubs.xcodeproj/xcshareddata/xcschemes/OHHTTPStubs iOS Framework.xcscheme
+1 −1 OHHTTPStubs/OHHTTPStubs.xcodeproj/xcshareddata/xcschemes/OHHTTPStubs iOS StaticLib.xcscheme
+1 −1 OHHTTPStubs/OHHTTPStubs.xcodeproj/xcshareddata/xcschemes/OHHTTPStubs tvOS Framework.xcscheme
+2 −2 OHHTTPStubs/Sources/HTTPMessage/OHHTTPStubsResponse+HTTPMessage.h
+2 −0 OHHTTPStubs/Sources/NSURLSession/NSURLRequest+HTTPBodyTesting.m
+2 −2 OHHTTPStubs/Sources/OHHTTPStubsResponse.h
+97 −25 OHHTTPStubs/Sources/Swift/OHHTTPStubsSwift.swift
+107 −13 OHHTTPStubs/UnitTests/Test Suites/SwiftHelpersTests.swift
+104 −26 README.md
1 change: 0 additions & 1 deletion Carthage/Checkouts/ReactiveCocoa
Submodule ReactiveCocoa deleted from f214c9
1 change: 1 addition & 0 deletions Carthage/Checkouts/ReactiveSwift
Submodule ReactiveSwift added at 55345e
1 change: 1 addition & 0 deletions Carthage/Checkouts/Runes
Submodule Runes added at 727fcf
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ client
}
```

Tentacle is built with [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa).
Tentacle is built with [ReactiveSwift](https://github.com/ReactiveCocoa/ReactiveSwift).

## License
Tentacle is available under the [MIT License](LICENSE.md)
78 changes: 48 additions & 30 deletions Tentacle.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
22 changes: 18 additions & 4 deletions Tentacle.xcodeproj/xcshareddata/xcschemes/Tentacle-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F802D4D11A5F218E005E236C"
BuildableName = "Runes.framework"
BlueprintName = "Runes-iOS"
ReferencedContainer = "container:Carthage/Checkouts/Runes/Runes.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down Expand Up @@ -57,9 +71,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D047260B19E49F82006002AA"
BuildableName = "ReactiveCocoa.framework"
BlueprintName = "ReactiveCocoa-iOS"
ReferencedContainer = "container:Carthage/Checkouts/ReactiveCocoa/ReactiveCocoa.xcodeproj">
BuildableName = "ReactiveSwift.framework"
BlueprintName = "ReactiveSwift-iOS"
ReferencedContainer = "container:Carthage/Checkouts/ReactiveSwift/ReactiveSwift.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
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 = "0800"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
5 changes: 4 additions & 1 deletion Tentacle.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 39 additions & 39 deletions Tentacle/ArgoExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,85 +10,85 @@ import Argo
import Foundation
import Result

internal func decode<T: Decodable where T == T.DecodedType>(object: AnyObject) -> Result<T, DecodeError> {
internal func decode<T: Decodable>(_ object: Any) -> Result<T, DecodeError> where T == T.DecodedType {
let decoded: Decoded<T> = decode(object)
switch decoded {
case let .Success(object):
return .Success(object)
case let .Failure(error):
return .Failure(error)
case let .success(object):
return .success(object)
case let .failure(error):
return .failure(error)
}
}

internal func decode<T: Decodable where T == T.DecodedType>(object: AnyObject) -> Result<[T], DecodeError> {
internal func decode<T: Decodable>(_ object: Any) -> Result<[T], DecodeError> where T == T.DecodedType {
let decoded: Decoded<[T]> = decode(object)
switch decoded {
case let .Success(object):
return .Success(object)
case let .Failure(error):
return .Failure(error)
case let .success(object):
return .success(object)
case let .failure(error):
return .failure(error)
}
}

internal func toString(number: Int) -> Decoded<String> {
return .Success(number.description)
internal func toString(_ number: Int) -> Decoded<String> {
return .success(number.description)
}

internal func toInt(string: String) -> Decoded<Int> {
internal func toInt(_ string: String) -> Decoded<Int> {
if let int = Int(string) {
return .Success(int)
return .success(int)
} else {
return .Failure(.Custom("String is not a valid number"))
return .failure(.custom("String is not a valid number"))
}
}

internal func toIssueState(string: String) -> Decoded<Issue.State> {
internal func toIssueState(_ string: String) -> Decoded<Issue.State> {
if let state = Issue.State(rawValue: string) {
return .Success(state)
return .success(state)
} else {
return .Failure(.Custom("String \(string) does not represent a valid issue state"))
return .failure(.custom("String \(string) does not represent a valid issue state"))
}
}

internal func toNSDate(string: String) -> Decoded<NSDate> {
if let date = NSDateFormatter.ISO8601.dateFromString(string) {
return .Success(date)
internal func toDate(_ string: String) -> Decoded<Date> {
if let date = DateFormatter.iso8601.date(from: string) {
return .success(date)
} else {
return .Failure(.Custom("Date is not ISO8601 formatted"))
return .failure(.custom("Date is not ISO8601 formatted"))
}
}

internal func toOptionalNSDate(string: String?) -> Decoded<NSDate?> {
guard let string = string else { return .Success(nil) }
if let date = NSDateFormatter.ISO8601.dateFromString(string) {
return .Success(date)
internal func toOptionalDate(_ string: String?) -> Decoded<Date?> {
guard let string = string else { return .success(nil) }
if let date = DateFormatter.iso8601.date(from: string) {
return .success(date)
} else {
return .Failure(.Custom("Date is not ISO8601 formatted"))
return .failure(.custom("Date is not ISO8601 formatted"))
}
}

internal func toNSURL(string: String) -> Decoded<NSURL> {
if let url = NSURL(string: string) {
return .Success(url)
internal func toURL(_ string: String) -> Decoded<URL> {
if let url = URL(string: string) {
return .success(url)
} else {
return .Failure(.Custom("URL \(string) is not properly formatted"))
return .failure(.custom("URL \(string) is not properly formatted"))
}
}

internal func toOptionalNSURL(string: String?) -> Decoded<NSURL?> {
guard let string = string else { return .Success(nil) }
internal func toOptionalURL(_ string: String?) -> Decoded<URL?> {
guard let string = string else { return .success(nil) }

return .Success(NSURL(string: string))
return .success(URL(string: string))
}

internal func toColor(string: String) -> Decoded<Color> {
return .Success(Color(hex: string))
internal func toColor(_ string: String) -> Decoded<Color> {
return .success(Color(hex: string))
}

internal func toUserType(string: String) -> Decoded<User.UserType> {
internal func toUserType(_ string: String) -> Decoded<User.UserType> {
if let type = User.UserType(rawValue: string) {
return .Success(type)
return .success(type)
} else {
return .Failure(.Custom("String \(string) does not represent a valid user type"))
return .failure(.custom("String \(string) does not represent a valid user type"))
}
}
55 changes: 55 additions & 0 deletions Tentacle/Availability.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// Availability.swift
// Tentacle
//
// Created by Syo Ikeda on 11/6/16.
// Copyright © 2016 Matt Diephouse. All rights reserved.
//

import Foundation
import ReactiveSwift

extension DateFormatter {
@available(*, unavailable, renamed: "iso8601")
@nonobjc public static var ISO8601: DateFormatter { fatalError() }
}

extension Release.Asset {
@available(*, unavailable, renamed: "apiURL")
public var APIURL: URL { fatalError() }
}

extension Client {
@available(*, unavailable, renamed: "releases(in:page:perPage:)")
public func releasesInRepository(_ repository: Repository, page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [Release]), Error> { fatalError() }

@available(*, unavailable, renamed: "release(forTag:in:)")
public func releaseForTag(_ tag: String, inRepository repository: Repository) -> SignalProducer<(Response, Release), Error> { fatalError() }

@available(*, unavailable, renamed: "download(asset:)")
public func downloadAsset(_ asset: Release.Asset) -> SignalProducer<URL, Error> { fatalError() }

@available(*, unavailable, renamed: "user(login:)")
public func userWithLogin(_ login: String) -> SignalProducer<(Response, UserInfo), Error> { fatalError() }

@available(*, unavailable, renamed: "assignedIssues(page:perPage:)")
public func assignedIssues(_ page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [Issue]), Error> { fatalError() }

@available(*, unavailable, renamed: "issues(in:page:perPage:)")
public func issuesInRepository(_ repository: Repository, page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [Issue]), Error> { fatalError() }

@available(*, unavailable, renamed: "comments(onIssue:in:page:perPage:)")
public func commentsOnIssue(_ issue: Int, repository: Repository, page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [Comment]), Error> { fatalError() }

@available(*, unavailable, renamed: "repositories(page:perPage:)")
public func repositories(_ page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [RepositoryInfo]), Error> { fatalError() }

@available(*, unavailable, renamed: "repositories(forUser:page:perPage:)")
public func repositoriesForUser(_ user: String, page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [RepositoryInfo]), Error> { fatalError() }

@available(*, unavailable, renamed: "repositories(forOrganization:page:perPage:)")
public func repositoriesForOrganization(_ organization: String, page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [RepositoryInfo]), Error> { fatalError() }

@available(*, unavailable, renamed: "publicRepositories(page:perPage:)")
public func publicRepositories(_ page: UInt = 1, perPage: UInt = 30) -> SignalProducer<(Response, [RepositoryInfo]), Error> { fatalError() }
}
Loading

0 comments on commit ae68d95

Please sign in to comment.