Skip to content

Commit

Permalink
4.0.0 (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Smallman <srsmallman@mac.com>
  • Loading branch information
sammysmallman authored Jun 4, 2024
1 parent 758b977 commit 85279d6
Show file tree
Hide file tree
Showing 25 changed files with 42 additions and 47 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let package = Package(
name: "OSCKit",
platforms: [
.iOS(.v9),
.macOS(.v10_10),
.macOS(.v10_15),
.tvOS(.v9)
],
products: [
Expand All @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
]
```

Expand Down Expand Up @@ -121,7 +121,7 @@ do {

Send the packet
```swift
client.send(message)
client.send(.message(message))
```
</details>
<details closed>
Expand Down Expand Up @@ -259,7 +259,7 @@ do {

Send the packet
```swift
client.send(message)
client.send(.message(message))
```
</details>
<details closed>
Expand Down Expand Up @@ -391,7 +391,7 @@ do {

Send the packet
```swift
peer.send(message)
peer.send(.message(message))
```
</details>

Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/Extensions/Numeric.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/Extensions/UInt32.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/LICENSE.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 4 additions & 4 deletions Sources/OSCKit/OSCKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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 = {
Expand All @@ -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])
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCSentPacket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
3 changes: 2 additions & 1 deletion Sources/OSCKit/OSCTcp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -166,6 +166,7 @@ internal struct OSCTcp {
state.data.removeAll()
dispatchHandler(packet)
} catch {
state.data.removeAll()
throw error
}
case slipEsc:
Expand Down
6 changes: 3 additions & 3 deletions Sources/OSCKit/OSCTcpClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCTcpClientConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCTcpClientDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
6 changes: 3 additions & 3 deletions Sources/OSCKit/OSCTcpServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCTcpServerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCTcpServerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpClientConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpClientDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
4 changes: 2 additions & 2 deletions Sources/OSCKit/OSCUdpPeer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpPeerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpPeerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
4 changes: 2 additions & 2 deletions Sources/OSCKit/OSCUdpServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpServerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion Sources/OSCKit/OSCUdpServerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
12 changes: 3 additions & 9 deletions Tests/OSCKitTests/OSCKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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("<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"))
}

func testCoreOSCLicense() {
let license = CoreOSC.license
XCTAssertTrue(license.hasPrefix("Copyright © 2022 Sam Smallman. https://github.com/SammySmallman"))
XCTAssertTrue(license.hasSuffix("<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"))
}


}

0 comments on commit 85279d6

Please sign in to comment.