diff --git a/Package.resolved b/Package.resolved
index 824d2af..22d448f 100644
--- a/Package.resolved
+++ b/Package.resolved
@@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/sammysmallman/CoreOSC.git",
"state": {
"branch": null,
- "revision": "c8f1080e31dae7bcfbd1660018f2ed8b11228e1a",
- "version": "1.1.0"
+ "revision": "20581ab989c36617ffee528d0e2b24b14141d31b",
+ "version": "2.0.0"
}
},
{
diff --git a/Package.swift b/Package.swift
index 37c9785..a65edd9 100644
--- a/Package.swift
+++ b/Package.swift
@@ -5,7 +5,7 @@ let package = Package(
name: "OSCKit",
platforms: [
.iOS(.v9),
- .macOS(.v10_10),
+ .macOS(.v10_15),
.tvOS(.v9)
],
products: [
@@ -16,7 +16,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/robbiehanson/CocoaAsyncSocket", from: "7.6.4"),
.package(name: "NetUtils" ,url: "https://github.com/svdo/swift-netutils", from: "4.1.0"),
- .package(url: "https://github.com/sammysmallman/CoreOSC.git", from: "1.2.1")
+ .package(url: "https://github.com/sammysmallman/CoreOSC.git", from: "2.0.0")
],
targets: [
.target(
diff --git a/README.md b/README.md
index 7396631..93d5555 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ Add the package dependency to your Package.swift and depend on "OSCKit" in the n
``` swift
dependencies: [
- .package(url: "https://github.com/SammySmallman/OSCKit", .upToNextMajor(from: "3.2.0"))
+ .package(url: "https://github.com/SammySmallman/OSCKit", .upToNextMajor(from: "4.0.0"))
]
```
@@ -121,7 +121,7 @@ do {
Send the packet
```swift
-client.send(message)
+client.send(.message(message))
```
@@ -259,7 +259,7 @@ do {
Send the packet
```swift
-client.send(message)
+client.send(.message(message))
```
@@ -391,7 +391,7 @@ do {
Send the packet
```swift
-peer.send(message)
+peer.send(.message(message))
```
diff --git a/Sources/OSCKit/Extensions/Numeric.swift b/Sources/OSCKit/Extensions/Numeric.swift
index 6aaf442..1683617 100644
--- a/Sources/OSCKit/Extensions/Numeric.swift
+++ b/Sources/OSCKit/Extensions/Numeric.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 13/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/Extensions/UInt32.swift b/Sources/OSCKit/Extensions/UInt32.swift
index d6b5115..d845e7b 100644
--- a/Sources/OSCKit/Extensions/UInt32.swift
+++ b/Sources/OSCKit/Extensions/UInt32.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 18/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/LICENSE.md b/Sources/OSCKit/LICENSE.md
index 72c65e3..cb0d0e7 100644
--- a/Sources/OSCKit/LICENSE.md
+++ b/Sources/OSCKit/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
This file is part of OSCKit
diff --git a/Sources/OSCKit/OSCKit.swift b/Sources/OSCKit/OSCKit.swift
index d87eedf..f191d0b 100644
--- a/Sources/OSCKit/OSCKit.swift
+++ b/Sources/OSCKit/OSCKit.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 22/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
@@ -30,7 +30,7 @@ import Foundation
public enum OSCKit {
/// This package's semantic version number, mirrored also in git history as a `git tag`.
- static let version: String = "3.2.0"
+ static let version: String = "4.0.0"
/// The license agreement this repository is licensed under.
static let license: String = {
@@ -50,7 +50,7 @@ public enum OSCKit {
/// Returns an `OSCMessage` response corresponding to the given packet.
static func message(for packet: OSCPacket) -> OSCMessage? {
- guard let message = packet as? OSCMessage else { return nil }
+ guard case let .message(message) = packet else { return nil }
switch message.addressPattern.fullPath {
case OSCKit.oscKitVersion:
return try! OSCMessage(with: OSCKit.oscKitVersion, arguments: [OSCKit.version])
@@ -67,7 +67,7 @@ public enum OSCKit {
/// Returns a boolean value indicating whether a packet should be listened to.
static func listening(for packet: OSCPacket) -> Bool {
- guard let message = packet as? OSCMessage else { return true }
+ guard case let .message(message) = packet else { return true }
switch message.addressPattern.fullPath {
case OSCKit.oscKitVersion, OSCKit.oscKitLicense,
OSCKit.coreOscVersion, OSCKit.coreOscLicense:
diff --git a/Sources/OSCKit/OSCSentPacket.swift b/Sources/OSCKit/OSCSentPacket.swift
index e81431e..363d6a6 100644
--- a/Sources/OSCKit/OSCSentPacket.swift
+++ b/Sources/OSCKit/OSCSentPacket.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 08/09/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCTcp.swift b/Sources/OSCKit/OSCTcp.swift
index 174aa7a..7beffb5 100644
--- a/Sources/OSCKit/OSCTcp.swift
+++ b/Sources/OSCKit/OSCTcp.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 09/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
@@ -166,6 +166,7 @@ internal struct OSCTcp {
state.data.removeAll()
dispatchHandler(packet)
} catch {
+ state.data.removeAll()
throw error
}
case slipEsc:
diff --git a/Sources/OSCKit/OSCTcpClient.swift b/Sources/OSCKit/OSCTcpClient.swift
index b217436..b787360 100644
--- a/Sources/OSCKit/OSCTcpClient.swift
+++ b/Sources/OSCKit/OSCTcpClient.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 09/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
@@ -270,7 +270,7 @@ extension OSCTcpClient: GCDAsyncSocketDelegate {
guard let strongSelf = self,
let delegate = strongSelf.delegate else { return }
if let message = OSCKit.message(for: packet) {
- try? strongSelf.send(message)
+ try? strongSelf.send(.message(message))
} else {
delegate.client(strongSelf, didReceivePacket: packet)
}
@@ -282,7 +282,7 @@ extension OSCTcpClient: GCDAsyncSocketDelegate {
guard let strongSelf = self,
let delegate = strongSelf.delegate else { return }
if let message = OSCKit.message(for: packet) {
- try? strongSelf.send(message)
+ try? strongSelf.send(.message(message))
} else {
delegate.client(strongSelf, didReceivePacket: packet)
}
diff --git a/Sources/OSCKit/OSCTcpClientConfiguration.swift b/Sources/OSCKit/OSCTcpClientConfiguration.swift
index 1be4855..cdcee78 100644
--- a/Sources/OSCKit/OSCTcpClientConfiguration.swift
+++ b/Sources/OSCKit/OSCTcpClientConfiguration.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 25/06/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCTcpClientDelegate.swift b/Sources/OSCKit/OSCTcpClientDelegate.swift
index 6bb2dac..6295c25 100644
--- a/Sources/OSCKit/OSCTcpClientDelegate.swift
+++ b/Sources/OSCKit/OSCTcpClientDelegate.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 09/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCTcpServer.swift b/Sources/OSCKit/OSCTcpServer.swift
index 4626b5a..d1b84da 100644
--- a/Sources/OSCKit/OSCTcpServer.swift
+++ b/Sources/OSCKit/OSCTcpServer.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 10/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
@@ -325,7 +325,7 @@ extension OSCTcpServer: GCDAsyncSocketDelegate {
guard let strongSelf = self,
let host = sock.connectedHost else { return }
if let message = OSCKit.message(for: packet) {
- strongSelf.send(message)
+ strongSelf.send(.message(message))
} else {
guard let delegate = strongSelf.delegate else { return }
delegate.server(strongSelf,
@@ -341,7 +341,7 @@ extension OSCTcpServer: GCDAsyncSocketDelegate {
guard let strongSelf = self,
let host = sock.connectedHost else { return }
if let message = OSCKit.message(for: packet) {
- strongSelf.send(message)
+ strongSelf.send(.message(message))
} else {
guard let delegate = strongSelf.delegate else { return }
delegate.server(strongSelf,
diff --git a/Sources/OSCKit/OSCTcpServerConfiguration.swift b/Sources/OSCKit/OSCTcpServerConfiguration.swift
index 21ce2b5..b11f72d 100644
--- a/Sources/OSCKit/OSCTcpServerConfiguration.swift
+++ b/Sources/OSCKit/OSCTcpServerConfiguration.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 25/06/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCTcpServerDelegate.swift b/Sources/OSCKit/OSCTcpServerDelegate.swift
index 0f91cdf..e2dbc12 100644
--- a/Sources/OSCKit/OSCTcpServerDelegate.swift
+++ b/Sources/OSCKit/OSCTcpServerDelegate.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 10/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpClient.swift b/Sources/OSCKit/OSCUdpClient.swift
index 5e1a02f..ceec9d0 100644
--- a/Sources/OSCKit/OSCUdpClient.swift
+++ b/Sources/OSCKit/OSCUdpClient.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 07/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpClientConfiguration.swift b/Sources/OSCKit/OSCUdpClientConfiguration.swift
index 09bab4d..3dba72e 100644
--- a/Sources/OSCKit/OSCUdpClientConfiguration.swift
+++ b/Sources/OSCKit/OSCUdpClientConfiguration.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 25/06/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpClientDelegate.swift b/Sources/OSCKit/OSCUdpClientDelegate.swift
index 67625cb..0085459 100644
--- a/Sources/OSCKit/OSCUdpClientDelegate.swift
+++ b/Sources/OSCKit/OSCUdpClientDelegate.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 09/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpPeer.swift b/Sources/OSCKit/OSCUdpPeer.swift
index 8db037d..f82dc35 100644
--- a/Sources/OSCKit/OSCUdpPeer.swift
+++ b/Sources/OSCKit/OSCUdpPeer.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 08/09/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
@@ -266,7 +266,7 @@ extension OSCUdpPeer: GCDAsyncUdpSocketDelegate {
do {
let packet = try OSCParser.packet(from: data)
if let message = OSCKit.message(for: packet) {
- try? send(message)
+ try? send(.message(message))
} else {
delegate?.peer(self,
didReceivePacket: packet,
diff --git a/Sources/OSCKit/OSCUdpPeerConfiguration.swift b/Sources/OSCKit/OSCUdpPeerConfiguration.swift
index 8655a93..e635c84 100644
--- a/Sources/OSCKit/OSCUdpPeerConfiguration.swift
+++ b/Sources/OSCKit/OSCUdpPeerConfiguration.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 08/09/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpPeerDelegate.swift b/Sources/OSCKit/OSCUdpPeerDelegate.swift
index 46d88fd..b3c65ff 100644
--- a/Sources/OSCKit/OSCUdpPeerDelegate.swift
+++ b/Sources/OSCKit/OSCUdpPeerDelegate.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 08/09/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpServer.swift b/Sources/OSCKit/OSCUdpServer.swift
index 1b164db..7d030b9 100644
--- a/Sources/OSCKit/OSCUdpServer.swift
+++ b/Sources/OSCKit/OSCUdpServer.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 07/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
@@ -276,7 +276,7 @@ extension OSCUdpServer: GCDAsyncUdpSocketDelegate {
let port = GCDAsyncUdpSocket.port(fromAddress: address)
let packet = try OSCParser.packet(from: data)
if let message = OSCKit.message(for: packet) {
- try? OSCUdpClient(host: host, port: port).send(message)
+ try? OSCUdpClient(host: host, port: port).send(.message(message))
} else {
delegate?.server(self,
didReceivePacket: packet,
diff --git a/Sources/OSCKit/OSCUdpServerConfiguration.swift b/Sources/OSCKit/OSCUdpServerConfiguration.swift
index 6025a33..7f62c78 100644
--- a/Sources/OSCKit/OSCUdpServerConfiguration.swift
+++ b/Sources/OSCKit/OSCUdpServerConfiguration.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 25/06/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Sources/OSCKit/OSCUdpServerDelegate.swift b/Sources/OSCKit/OSCUdpServerDelegate.swift
index 3a392f5..181b912 100644
--- a/Sources/OSCKit/OSCUdpServerDelegate.swift
+++ b/Sources/OSCKit/OSCUdpServerDelegate.swift
@@ -3,7 +3,7 @@
// OSCKit
//
// Created by Sam Smallman on 09/07/2021.
-// Copyright © 2022 Sam Smallman. https://github.com/SammySmallman
+// Copyright © 2021 Sam Smallman. https://github.com/SammySmallman
//
// This file is part of OSCKit
//
diff --git a/Tests/OSCKitTests/OSCKitTests.swift b/Tests/OSCKitTests/OSCKitTests.swift
index 261b6b8..3eb2b3d 100644
--- a/Tests/OSCKitTests/OSCKitTests.swift
+++ b/Tests/OSCKitTests/OSCKitTests.swift
@@ -29,19 +29,13 @@ import XCTest
class OSCKitTests: XCTestCase {
func testVersion() {
- XCTAssertEqual(OSCKit.version, "3.2.0")
+ XCTAssertEqual(OSCKit.version, "4.0.0")
}
func testLicense() {
let license = OSCKit.license
- XCTAssertTrue(license.hasPrefix("Copyright © 2022 Sam Smallman. https://github.com/SammySmallman"))
+ XCTAssertTrue(license.hasPrefix("Copyright © 2021 Sam Smallman. https://github.com/SammySmallman"))
XCTAssertTrue(license.hasSuffix(".\n"))
}
-
- func testCoreOSCLicense() {
- let license = CoreOSC.license
- XCTAssertTrue(license.hasPrefix("Copyright © 2022 Sam Smallman. https://github.com/SammySmallman"))
- XCTAssertTrue(license.hasSuffix(".\n"))
- }
-
+
}