Skip to content

Commit b9bc390

Browse files
committed
Update OpenGraph dependency to fix API rename
1 parent 0a2ace6 commit b9bc390

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

Package.resolved

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let package = Package(
1717
.library(name: "AGDebugKit", targets: ["AGDebugKit"]),
1818
],
1919
dependencies: [
20-
.package(url: "https://github.com/OpenSwiftUIProject/OpenGraph.git", from: "0.0.3"),
20+
.package(url: "https://github.com/OpenSwiftUIProject/OpenGraph.git", exact: "0.0.5"),
2121
.package(url: "https://github.com/OpenSwiftUIProject/Socket.git", from: "0.3.3"),
2222
],
2323
targets: [

Sources/AGDebugKit/DebugServer/DebugServer.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ private import AttributeGraph
99
import Foundation
1010

1111
public final class DebugServer {
12-
private var server: UnsafeRawPointer?
12+
private var server: AGDebugServer?
1313

1414
public static let shared = DebugServer()
1515

1616
public func start(_ mode: Mode = .local) {
17-
server = debugServerStart(mode.rawValue)
17+
server = AGDebugServer.start(mode: 0)?.takeUnretainedValue()
1818
}
1919

2020
public func stop() {
21-
debugServerStop()
21+
AGDebugServer.stop()
2222
server = nil
2323
}
2424

25-
public func run(timeout: Int) {
25+
public func run(timeout: Int32) {
2626
guard let _ = server else { return }
27-
debugServerRun(timeout)
27+
AGDebugServer.run(timeout: timeout)
2828
}
2929

3030
public var url: URL? {
3131
guard let _ = server,
32-
let url = debugServerCopyURL() as? URL
32+
let url = AGDebugServer.copyURL()
3333
else { return nil }
34-
return url
34+
return url.takeUnretainedValue() as URL
3535
}
3636

3737
/// A Bool value indicating whether the server has been started successfully

Sources/AGDebugKit/Graph.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,37 @@ import Foundation
1010

1111
/// A wrapper class for AGGraph
1212
public final class Graph {
13-
let graph: UnsafeRawPointer?
13+
private let graph: AGGraph?
1414

1515
public init() {
1616
graph = nil
1717
}
1818

1919
public init(_ pointer: UnsafeRawPointer?) {
20-
graph = graphCreateShared(pointer)
20+
if let pointer {
21+
let sharedGraph = pointer.assumingMemoryBound(to: AGGraph.self).pointee
22+
graph = AGGraph(shared: sharedGraph)
23+
} else {
24+
graph = AGGraph()
25+
}
2126
}
2227

2328
public var dict: NSDictionary? {
2429
let options = ["format": "graph/dict"] as NSDictionary
25-
guard let description = graphDescription(options: options) else {
30+
guard let description = AGGraph.description(nil, options: options) else {
2631
return nil
2732
}
28-
return Unmanaged<NSDictionary>.fromOpaque(description).takeUnretainedValue()
33+
return description.takeUnretainedValue() as? NSDictionary
2934
}
3035

3136
public var dot: String? {
3237
let options = ["format": "graph/dot"] as NSDictionary
3338
guard let graph,
34-
let description = graphDescription(graph, options: options)
39+
let description = AGGraph.description(graph, options: options)
3540
else {
3641
return nil
3742
}
38-
return Unmanaged<NSString>.fromOpaque(description).takeUnretainedValue() as String
43+
return description.takeUnretainedValue() as? String
3944
}
4045

4146
/// Archive the current AGGraph's state to temporary directory
@@ -47,6 +52,6 @@ public final class Graph {
4752
/// You can then consume the exported JSON file directly or via
4853
/// [GraphConverter](https://github.com/OpenSwiftUIProject/GraphConverter)
4954
public static func archiveGraph(name: String) {
50-
name.withCString { graphArchiveJSON($0) }
55+
name.withCString { AGGraph.archiveJSON(name: $0) }
5156
}
5257
}

Sources/DebugClient/ContentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct ContentView: View {
1616

1717
@State private var started = false
1818
@State private var selectedMode: Mode = .local
19-
@State private var timeout = 1
19+
@State private var timeout: Int32 = 1
2020

2121
@State private var host = ""
2222
@State private var port: UInt16 = 0

0 commit comments

Comments
 (0)