Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeGraphVendor(rawValue:) used to be failable when it was a RawRepresentable enum; making it non-failable can break downstream code that does optional binding (if let) or force-unwrapping on this initializer. If source-compatibility is a goal, consider also providing a failable init?(rawValue:) entry point.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// GraphShims.swift
// OAGShims.swift
// OpenAttributeGraphCompatibilityTests

#if OPENATTRIBUTEGRAPH
Expand Down