-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathOAGShims.swift
More file actions
101 lines (76 loc) · 2.81 KB
/
OAGShims.swift
File metadata and controls
101 lines (76 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// AGShims.swift
// OpenAttributeGraphShims
/// A type that identifies the underlying attribute graph implementation vendor.
///
/// Use `attributeGraphVendor` to check which vendor is active at runtime.
public struct AttributeGraphVendor: RawRepresentable, Hashable, CaseIterable {
public let rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
/// OpenAttributeGraph — the open-source implementation by OpenSwiftUIProject.
public static let oag = AttributeGraphVendor(rawValue: "org.OpenSwiftUIProject.OpenAttributeGraph")
/// Apple's private AttributeGraph framework.
public static let ag = AttributeGraphVendor(rawValue: "com.apple.AttributeGraph")
/// An incremental computation library for Swift by @jcmosc
public static let compute = AttributeGraphVendor(rawValue: "dev.incrematic.compute")
public static var allCases: [AttributeGraphVendor] { [.oag, .ag, .compute] }
}
#if OPENATTRIBUTEGRAPH_COMPUTE
@_exported public import Compute
public typealias OAGAttributeInfo = AGAttributeInfo
public typealias OAGCachedValueOptions = CachedValueOptions
public typealias OAGChangedValueFlags = AGChangedValueFlags
public typealias OAGInputOptions = AGInputOptions
public typealias OAGValue = AGChangedValue
public typealias OAGValueOptions = AGValueOptions
extension AnyAttribute {
public typealias Flags = Subgraph.Flags
}
extension AnyAttribute {
public var subgraph2: Subgraph? { nil }
}
extension Subgraph {
public typealias ChildFlags = AnyAttribute.Flags
}
extension Graph {
public static func startProfiling() {
startProfiling(nil)
}
public static func stopProfiling() {
stopProfiling(nil)
}
public func startProfiling() {
Self.startProfiling(self)
}
public func stopProfiling() {
Self.stopProfiling(self)
}
public func resetProfile() {
// TODO: placeholder
}
}
extension _AttributeBody {
public typealias Flags = _AttributeType.Flags
}
extension CachedValueOptions {
public static var _1: CachedValueOptions = .unprefetched
}
public let attributeGraphVendor = AttributeGraphVendor.compute
#elseif OPENATTRIBUTEGRAPH_ATTRIBUTEGRAPH
@_exported public import AttributeGraph
#if os(iOS) && !targetEnvironment(simulator)
@_exported public import _AttributeGraphDeviceSwiftShims
#endif
public typealias OAGAttributeInfo = AGAttributeInfo
public typealias OAGCachedValueOptions = AGCachedValueOptions
public typealias OAGChangedValueFlags = AGChangedValueFlags
public typealias OAGInputOptions = AGInputOptions
public typealias OAGValue = AGValue
public typealias OAGValueOptions = AGValueOptions
public let attributeGraphVendor = AttributeGraphVendor.ag
#else
@_exported import OpenAttributeGraph
public let attributeGraphVendor = AttributeGraphVendor.oag
#endif