Skip to content

Commit 2b14d3c

Browse files
committed
Swift 5.0 compatibility
1 parent 191795a commit 2b14d3c

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

OhhAuth.podspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
Pod::Spec.new do |s|
22
s.name = "OhhAuth"
3-
s.version = "1.0.0"
3+
s.version = "1.1.0"
44
s.summary = "Pure Swift implementation of the OAuth 1.0 protocol as an easy to use extension for the URLRequest type. (RFC-5849)"
55
s.authors = "Markus Wanke"
66
s.homepage = "https://github.com/mw99/OhhAuth"
77
s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
88
s.source = { :git => "https://github.com/mw99/OhhAuth.git", :tag => s.version }
99

10+
s.swift_version = '5'
11+
1012
s.ios.deployment_target = '8.0'
1113
s.osx.deployment_target = '10.10'
1214
s.tvos.deployment_target = '9.0'

Package.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
// swift-tools-version:4.0
2+
13
import PackageDescription
24

35
let package = Package(
4-
name: "OhhAuth"
6+
name: "OhhAuth",
7+
products: [
8+
.library(name: "OhhAuth", targets: ["OhhAuth"])
9+
],
10+
targets: [
11+
.target(name: "OhhAuth", path: ".")
12+
]
513
)

Sources/OhhAuth.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import Foundation
2525

26-
open class OhhAuth
26+
public class OhhAuth
2727
{
2828
/// Tuple to represent signing credentials. (consumer as well as user credentials)
2929
public typealias Credentials = (key: String, secret: String)
@@ -41,7 +41,7 @@ open class OhhAuth
4141
/// - userCredentials: user credentials (nil if this is a request without user association)
4242
///
4343
/// - Returns: OAuth HTTP header entry for the Authorization field.
44-
open static func calculateSignature(url: URL, method: String, parameter: [String: String],
44+
static func calculateSignature(url: URL, method: String, parameter: [String: String],
4545
consumerCredentials cc: Credentials, userCredentials uc: Credentials?) -> String
4646
{
4747
typealias Tup = (key: String, value: String)
@@ -99,7 +99,7 @@ open class OhhAuth
9999
/// - Parameter paras: url-form parameters
100100
/// - Parameter encoding: used string encoding (default: .utf8)
101101
/// - Returns: correctly percentage encoded url-form parameters
102-
open static func httpBody(forFormParameters paras: [String: String], encoding: String.Encoding = .utf8) -> Data?
102+
static func httpBody(forFormParameters paras: [String: String], encoding: String.Encoding = .utf8) -> Data?
103103
{
104104
let trans: (String, String) -> String = { k, v in
105105
return rfc3986encode(k) + "=" + rfc3986encode(v)
@@ -154,7 +154,7 @@ public extension URLRequest
154154
/// - paras: url-form parameters
155155
/// - consumerCredentials: consumer credentials
156156
/// - userCredentials: user credentials (nil if this is a request without user association)
157-
public mutating func oAuthSign(method: String, urlFormParameters paras: [String: String],
157+
mutating func oAuthSign(method: String, urlFormParameters paras: [String: String],
158158
consumerCredentials cc: OhhAuth.Credentials, userCredentials uc: OhhAuth.Credentials? = nil)
159159
{
160160
self.httpMethod = method.uppercased()
@@ -182,7 +182,7 @@ public extension URLRequest
182182
/// - contentType: HTTP header "Content-Type" entry (default: nil)
183183
/// - consumerCredentials: consumer credentials
184184
/// - userCredentials: user credentials (nil if this is a request without user association)
185-
public mutating func oAuthSign(method: String, body: Data? = nil, contentType: String? = nil,
185+
mutating func oAuthSign(method: String, body: Data? = nil, contentType: String? = nil,
186186
consumerCredentials cc: OhhAuth.Credentials, userCredentials uc: OhhAuth.Credentials? = nil)
187187
{
188188
self.httpMethod = method.uppercased()

0 commit comments

Comments
 (0)