File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ //
2
+ // Graph+Debug.swift
3
+ // OpenGraphShims
4
+
5
+ // FIXME: Update name in OpenGraph
6
+ public typealias Graph = OGGraph
7
+ public typealias Subgraph = OGSubgraph
8
+
9
+ #if canImport(Darwin)
10
+
11
+ import Foundation
12
+
13
+ @_spi ( Debug)
14
+ extension Graph {
15
+ public var dict : [ String : Any ] ? {
16
+ let options = [ " format " : " graph/dict " ] as NSDictionary
17
+ guard let description = Graph . description ( nil , options: options) else {
18
+ return nil
19
+ }
20
+ guard let dictionary = description. takeUnretainedValue ( ) as? NSDictionary else {
21
+ return nil
22
+ }
23
+ return dictionary as? [ String : Any ]
24
+ }
25
+
26
+ // style:
27
+ // - bold: empty input/output edge
28
+ // - dashed: indirect or has no value
29
+ // color:
30
+ // - red: is_changed
31
+ public var dot : String ? {
32
+ let options = [ " format " : " graph/dot " ] as NSDictionary
33
+ guard let description = Graph . description ( self , options: options)
34
+ else {
35
+ return nil
36
+ }
37
+ return description. takeUnretainedValue ( ) as? String
38
+ }
39
+ }
40
+
41
+ #endif
You can’t perform that action at this time.
0 commit comments