diff --git a/Sources/OpenAttributeGraphShims/GraphShims.swift b/Sources/OpenAttributeGraphShims/OAGShims.swift similarity index 67% rename from Sources/OpenAttributeGraphShims/GraphShims.swift rename to Sources/OpenAttributeGraphShims/OAGShims.swift index 12ef4159..aa9bf058 100644 --- a/Sources/OpenAttributeGraphShims/GraphShims.swift +++ b/Sources/OpenAttributeGraphShims/OAGShims.swift @@ -1,11 +1,27 @@ // -// GraphShims.swift +// AGShims.swift // OpenAttributeGraphShims -public enum AttributeGraphVendor: String { - case oag = "org.OpenSwiftUIProject.OpenAttributeGraph" - case ag = "com.apple.AttributeGraph" - case compute = "dev.incrematic.compute" +/// 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 diff --git a/Tests/OpenAttributeGraphCompatibilityTests/GraphShims.swift b/Tests/OpenAttributeGraphCompatibilityTests/OAGShims.swift similarity index 96% rename from Tests/OpenAttributeGraphCompatibilityTests/GraphShims.swift rename to Tests/OpenAttributeGraphCompatibilityTests/OAGShims.swift index aa40545e..18bc2f22 100644 --- a/Tests/OpenAttributeGraphCompatibilityTests/GraphShims.swift +++ b/Tests/OpenAttributeGraphCompatibilityTests/OAGShims.swift @@ -1,5 +1,5 @@ // -// GraphShims.swift +// OAGShims.swift // OpenAttributeGraphCompatibilityTests #if OPENATTRIBUTEGRAPH