From 7cef54332b9b5478dc8e92b6916ead671509ea52 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:14:17 +0800 Subject: [PATCH 1/2] Refactor AttributeGraphVendor from enum to RawRepresentable struct --- .../OpenAttributeGraphShims/GraphShims.swift | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Sources/OpenAttributeGraphShims/GraphShims.swift b/Sources/OpenAttributeGraphShims/GraphShims.swift index 12ef415..91aa221 100644 --- a/Sources/OpenAttributeGraphShims/GraphShims.swift +++ b/Sources/OpenAttributeGraphShims/GraphShims.swift @@ -2,10 +2,26 @@ // GraphShims.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 From eedc91ab556376619282617d0e5dbe3caedae593 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:45:59 +0800 Subject: [PATCH 2/2] Update shims file name --- .../{GraphShims.swift => OAGShims.swift} | 2 +- .../{GraphShims.swift => OAGShims.swift} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Sources/OpenAttributeGraphShims/{GraphShims.swift => OAGShims.swift} (99%) rename Tests/OpenAttributeGraphCompatibilityTests/{GraphShims.swift => OAGShims.swift} (96%) diff --git a/Sources/OpenAttributeGraphShims/GraphShims.swift b/Sources/OpenAttributeGraphShims/OAGShims.swift similarity index 99% rename from Sources/OpenAttributeGraphShims/GraphShims.swift rename to Sources/OpenAttributeGraphShims/OAGShims.swift index 91aa221..aa9bf05 100644 --- a/Sources/OpenAttributeGraphShims/GraphShims.swift +++ b/Sources/OpenAttributeGraphShims/OAGShims.swift @@ -1,5 +1,5 @@ // -// GraphShims.swift +// AGShims.swift // OpenAttributeGraphShims /// A type that identifies the underlying attribute graph implementation vendor. 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 aa40545..18bc2f2 100644 --- a/Tests/OpenAttributeGraphCompatibilityTests/GraphShims.swift +++ b/Tests/OpenAttributeGraphCompatibilityTests/OAGShims.swift @@ -1,5 +1,5 @@ // -// GraphShims.swift +// OAGShims.swift // OpenAttributeGraphCompatibilityTests #if OPENATTRIBUTEGRAPH