Skip to content

Commit 6fd3294

Browse files
committed
Revert "swift 2.3"
This reverts commit bfa163f.
1 parent bfa163f commit 6fd3294

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Source/SocketEngine.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
218218
return (NSURL(), NSURL())
219219
}
220220

221-
let urlPolling = NSURLComponents(string: url.absoluteString!)!
222-
let urlWebSocket = NSURLComponents(string: url.absoluteString!)!
221+
let urlPolling = NSURLComponents(string: url.absoluteString)!
222+
let urlWebSocket = NSURLComponents(string: url.absoluteString)!
223223
var queryString = ""
224224

225225
urlWebSocket.path = socketPath

Source/SocketIOClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable
7070
self.options = options
7171
self.socketURL = socketURL
7272

73-
if socketURL.absoluteString!.hasPrefix("https://") {
73+
if socketURL.absoluteString.hasPrefix("https://") {
7474
self.options.insertIgnore(.Secure(true))
7575
}
7676

Source/WebSocket/SSLSecurity.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ public class SSLSecurity : NSObject {
141141
}
142142
var policy: SecPolicyRef
143143
if self.validatedDN {
144-
policy = SecPolicyCreateSSL(true, domain)!
144+
policy = SecPolicyCreateSSL(true, domain)
145145
} else {
146-
policy = SecPolicyCreateBasicX509()!
146+
policy = SecPolicyCreateBasicX509()
147147
}
148148
SecTrustSetPolicies(trust,policy)
149149
if self.usePublicKeys {
@@ -164,10 +164,10 @@ public class SSLSecurity : NSObject {
164164
collect.append(SecCertificateCreateWithData(nil,cert)!)
165165
}
166166
SecTrustSetAnchorCertificates(trust,collect)
167-
var result = SecTrustResultType(rawValue: 0)
168-
SecTrustEvaluate(trust, &result!)
169-
let r = Int(result!.rawValue)
170-
if r == Int(SecTrustResultType.Unspecified.rawValue) || r == Int(SecTrustResultType.Proceed.rawValue) {
167+
var result: SecTrustResultType = 0
168+
SecTrustEvaluate(trust,&result)
169+
let r = Int(result)
170+
if r == kSecTrustResultUnspecified || r == kSecTrustResultProceed {
171171
var trustedCount = 0
172172
for serverCert in serverCerts {
173173
for cert in certs {
@@ -195,7 +195,7 @@ public class SSLSecurity : NSObject {
195195
func extractPublicKey(data: NSData) -> SecKeyRef? {
196196
guard let cert = SecCertificateCreateWithData(nil, data) else { return nil }
197197

198-
return extractPublicKeyFromCert(cert, policy: SecPolicyCreateBasicX509()!)
198+
return extractPublicKeyFromCert(cert, policy: SecPolicyCreateBasicX509())
199199
}
200200

201201
/**
@@ -211,7 +211,7 @@ public class SSLSecurity : NSObject {
211211

212212
guard let trust = possibleTrust else { return nil }
213213

214-
var result = SecTrustResultType(rawValue:0)!
214+
var result: SecTrustResultType = 0
215215
SecTrustEvaluate(trust, &result)
216216
return SecTrustCopyPublicKey(trust)
217217
}
@@ -246,7 +246,7 @@ public class SSLSecurity : NSObject {
246246
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKeyRef]()) { (keys: [SecKeyRef], index: Int) -> [SecKeyRef] in
247247
var keys = keys
248248
let cert = SecTrustGetCertificateAtIndex(trust, index)
249-
if let key = extractPublicKeyFromCert(cert!, policy: policy!) {
249+
if let key = extractPublicKeyFromCert(cert!, policy: policy) {
250250
keys.append(key)
251251
}
252252

@@ -257,4 +257,4 @@ public class SSLSecurity : NSObject {
257257
}
258258

259259

260-
}
260+
}

Source/WebSocket/WebSocket.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
227227

228228
var port = url.port
229229
if port == nil {
230-
if ["wss", "https"].contains(url.scheme!) {
230+
if ["wss", "https"].contains(url.scheme) {
231231
port = 443
232232
} else {
233233
port = 80
@@ -285,7 +285,7 @@ public class WebSocket : NSObject, NSStreamDelegate {
285285
guard let inStream = inputStream, let outStream = outputStream else { return }
286286
inStream.delegate = self
287287
outStream.delegate = self
288-
if ["wss", "https"].contains(url.scheme!) {
288+
if ["wss", "https"].contains(url.scheme) {
289289
inStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
290290
outStream.setProperty(NSStreamSocketSecurityLevelNegotiatedSSL, forKey: NSStreamSocketSecurityLevelKey)
291291
} else {

0 commit comments

Comments
 (0)