Skip to content

Commit 84e7255

Browse files
konstk1phimage
authored andcommitted
Update to swift tools 5.0 and Alamofire 5.0.0-rc.1
1 parent c1ac4b9 commit 84e7255

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Package.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:5.0
22
// Package.swift
33
/*
44
The MIT License (MIT)
@@ -24,15 +24,20 @@ import PackageDescription
2424

2525
let package = Package(
2626
name: "OAuthSwiftAlamofire",
27+
platforms: [.macOS(.v10_12),
28+
.iOS(.v10),
29+
.tvOS(.v10),
30+
.watchOS(.v3)],
2731
products: [
2832
.library(name: "OAuthSwiftAlamofire", targets: ["OAuthSwiftAlamofire"]),
2933
],
3034
dependencies: [
31-
.package(url: "https://github.com/OAuthSwift/OAuthSwift.git", from: "2.1.0"),
32-
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0-rc.1"),
35+
.package(url: "https://github.com/OAuthSwift/OAuthSwift.git", .branch("2.1.0")),
36+
.package(url: "https://github.com/Alamofire/Alamofire.git", .branch("5.0.0-rc.1")),
3337
],
3438
targets: [
3539
.target(name: "OAuthSwiftAlamofire", dependencies: ["OAuthSwift", "Alamofire"], path: "Sources"),
3640
.testTarget(name: "OAuthSwiftAlamofireTests", dependencies: ["OAuthSwiftAlamofire"], path: "Tests"),
37-
]
41+
],
42+
swiftLanguageVersions: [.v5]
3843
)

Sources/HTTPMethod.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public extension Alamofire.HTTPMethod {
2121
public extension OAuthSwiftHTTPRequest.Method {
2222

2323
var alamofire: Alamofire.HTTPMethod {
24-
return Alamofire.HTTPMethod(rawValue: self.rawValue)!
24+
return Alamofire.HTTPMethod(rawValue: self.rawValue)
2525
}
2626

2727
}

Sources/OAuthSwiftRequestInterceptor.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open class OAuthSwiftRequestInterceptor: RequestInterceptor {
2424
self.oauthSwift = oauthSwift
2525
}
2626

27-
open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (AFResult<URLRequest>) -> Void) {
27+
open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
2828
var config = OAuthSwiftHTTPRequest.Config(
2929
urlRequest: urlRequest,
3030
paramsLocation: paramsLocation,
@@ -104,7 +104,7 @@ open class OAuthSwift2RequestInterceptor: OAuthSwiftRequestInterceptor {
104104
guard let strongSelf = self else { return }
105105

106106
// map success result from TokenSuccess to Void, and failure from OAuthSwiftError to Error
107-
let refreshResult = result.map { _ in () }.mapError { .$0 as Error }
107+
let refreshResult = result.map { _ in () }.mapError { $0 as Error }
108108
completion(refreshResult)
109109

110110
strongSelf.isRefreshing = false
@@ -114,7 +114,6 @@ open class OAuthSwift2RequestInterceptor: OAuthSwiftRequestInterceptor {
114114
}
115115

116116
extension OAuth1Swift {
117-
118117
open var requestInterceptor: OAuthSwiftRequestInterceptor {
119118
return OAuthSwiftRequestInterceptor(self)
120119
}

0 commit comments

Comments
 (0)