Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
orchetect committed Sep 29, 2024
1 parent c3c574e commit 4079777
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/OSCKitCore/OSCAddressSpace/OSCAddressSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ extension OSCAddressSpace {
/// Returns all OSC address nodes matching the address pattern.
///
/// - Note: This will not automatically execute the closure blocks that may be associated with
/// the methods. To execute the closures, invoke the ``dispatch(_:on:)`` function instead.
/// the methods. To execute the closures, invoke the ``dispatch(_:)`` function instead.
///
/// - Remark: An OSC Method is defined as being the last path component in the address. OSC
/// Methods are the potential destinations of OSC messages received by the OSC server and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func performMethodB(_ str: String, _ int: Int?) { }

- When registering a local method, it can also store a closure. This closure can be executed automatically when matching against a received OSC message's address pattern.
- When an OSC message is received:
- Pass its address pattern to the ``OSCAddressSpace/dispatch(_:on:)``.
- Pass its address pattern to the ``OSCAddressSpace/dispatch(_:)``.
- This method will pattern-match it against all registered local addresses and execute their closures, optionally on a specified queue.
- It also returns an array of local method IDs that match exactly like ``OSCAddressSpace/methods(matching:)`` (which may be discarded if handling of unregistered/unrecognized methods is not needed).
- If the returned method ID array is empty, that indicates that no methods matched the address pattern. In this case you may want to handle the unhandled message in a special way.
Expand All @@ -120,8 +120,8 @@ addressSpace.register(localAddress: "/some/address/methodB") { values in
```

```swift
func handle(message: OSCMessage) throws {
let ids = addressSpace.dispatch(message)
func handle(message: OSCMessage) async throws {
let ids = await addressSpace.dispatch(message)
if ids.isEmpty {
print("Received unhandled OSC message:", message)
}
Expand Down

0 comments on commit 4079777

Please sign in to comment.