Skip to content

Commit f007b86

Browse files
author
David Jedeikin
authored
Merge pull request #3 from mojio/swift/5.0
Swift 5 compat update PHIOS-3138
2 parents 68755ca + 4166c0f commit f007b86

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Source/WebSocket.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ private class InnerWebSocket: Hashable {
608608

609609
var hashValue: Int { return id }
610610

611+
func hash(into hasher: inout Hasher) {
612+
hasher.combine(id)
613+
}
614+
611615
init(request: URLRequest, subProtocols : [String] = [], stub : Bool = false){
612616
pthread_mutex_init(&mutex, nil)
613617
self.id = manager.nextId()
@@ -974,8 +978,8 @@ private class InnerWebSocket: Hashable {
974978
}
975979

976980
func closeConn() {
977-
rd.remove(from: RunLoop.main, forMode: .default)
978-
wr.remove(from: RunLoop.main, forMode: .default)
981+
rd.remove(from: RunLoop.main, forMode: RunLoop.Mode.default)
982+
wr.remove(from: RunLoop.main, forMode: RunLoop.Mode.default)
979983
rd.delegate = nil
980984
wr.delegate = nil
981985
rd.close()
@@ -1094,8 +1098,8 @@ private class InnerWebSocket: Hashable {
10941098
}
10951099
rd.delegate = delegate
10961100
wr.delegate = delegate
1097-
rd.schedule(in: RunLoop.main, forMode: .default)
1098-
wr.schedule(in: RunLoop.main, forMode: .default)
1101+
rd.schedule(in: RunLoop.main, forMode: RunLoop.Mode.default)
1102+
wr.schedule(in: RunLoop.main, forMode: RunLoop.Mode.default)
10991103
rd.open()
11001104
wr.open()
11011105
try write(header, length: header.count)
@@ -1693,7 +1697,8 @@ open class WebSocket: NSObject {
16931697
fileprivate var ws: InnerWebSocket
16941698
fileprivate var id = manager.nextId()
16951699
fileprivate var opened: Bool
1696-
open override var hashValue: Int { return id }
1700+
open override var hash: Int { return id }
1701+
16971702
/// Create a WebSocket connection to a URL; this should be the URL to which the WebSocket server will respond.
16981703
public convenience init(_ url: String){
16991704
self.init(request: URLRequest(url: URL(string: url)!), subProtocols: [])

SwiftWebSocket.xcodeproj/project.pbxproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
};
334334
03D1E7021B20897100AC49AC = {
335335
CreatedOnToolsVersion = 6.3.2;
336-
LastSwiftMigration = 0900;
336+
LastSwiftMigration = 1020;
337337
};
338338
03D70CCB1BDAC5EC00D245C3 = {
339339
CreatedOnToolsVersion = 7.1;
@@ -355,6 +355,7 @@
355355
developmentRegion = English;
356356
hasScannedForEncodings = 0;
357357
knownRegions = (
358+
English,
358359
en,
359360
Base,
360361
);
@@ -666,8 +667,7 @@
666667
PRODUCT_BUNDLE_IDENTIFIER = "com.oncast.$(PRODUCT_NAME:rfc1034identifier)";
667668
PRODUCT_NAME = SwiftWebSocket;
668669
SKIP_INSTALL = YES;
669-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
670-
SWIFT_VERSION = 4.0;
670+
SWIFT_VERSION = 5.0;
671671
};
672672
name = Debug;
673673
};
@@ -688,8 +688,7 @@
688688
PRODUCT_NAME = SwiftWebSocket;
689689
SKIP_INSTALL = YES;
690690
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
691-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
692-
SWIFT_VERSION = 4.0;
691+
SWIFT_VERSION = 5.0;
693692
};
694693
name = Release;
695694
};

0 commit comments

Comments
 (0)