Skip to content

Commit dcbc002

Browse files
committed
Add public Command type
1 parent e45f09f commit dcbc002

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Sources/OpenGraphShims/DebugClient.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,19 @@ public struct ConnectionUpdates: AsyncSequence {
2626

2727
@_spi(Debug)
2828
public final class DebugClient {
29+
public enum Command: String, CaseIterable, Hashable {
30+
case graphDescription = "graph/description"
31+
case profilerStart = "profiler/start"
32+
case profilerStop = "profiler/stop"
33+
case profilerReset = "profiler/reset"
34+
case profilerMark = "profiler/mark"
35+
}
36+
2937
private var connection: NWConnection?
3038
private let queue = DispatchQueue(label: "org.openswiftuiproject.opengraph.debugclient")
3139

40+
public init() {}
41+
3242
public func connect(to url: URL) -> ConnectionUpdates {
3343
guard let host = url.host, let port = url.port else {
3444
return ConnectionUpdates(stream: AsyncStream { continuation in

Tests/OpenGraphCxxTests/DebugServer/DebugServerTests.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ import Testing
99

1010
@MainActor
1111
struct DebugServerTests {
12-
private enum Command: String, CaseIterable, Hashable {
13-
case graphDescription = "graph/description"
14-
case profilerStart = "profiler/start"
15-
case profilerStop = "profiler/stop"
16-
case profilerReset = "profiler/reset"
17-
case profilerMark = "profiler/mark"
18-
}
12+
typealias Command = DebugClient.Command
1913

2014
private func data(for command: Command) throws -> Data{
2115
let command = ["command": command.rawValue]

0 commit comments

Comments
 (0)