diff --git a/Sources/CodableDatastore/Datastore/DatastoreDescriptor.swift b/Sources/CodableDatastore/Datastore/DatastoreDescriptor.swift index dcc61cf..89daac1 100644 --- a/Sources/CodableDatastore/Datastore/DatastoreDescriptor.swift +++ b/Sources/CodableDatastore/Datastore/DatastoreDescriptor.swift @@ -133,7 +133,7 @@ extension DatastoreDescriptor { for child in mirror.children { guard let label = child.label else { continue } - guard let childValue = child.value as? any _Indexed else { continue } + guard let childValue = child.value as? any _IndexedProtocol else { continue } let actualKey: String if label.prefix(1) == "_" { diff --git a/Sources/CodableDatastore/Indexes/Indexed.swift b/Sources/CodableDatastore/Indexes/Indexed.swift index a056be9..465534a 100644 --- a/Sources/CodableDatastore/Indexes/Indexed.swift +++ b/Sources/CodableDatastore/Indexes/Indexed.swift @@ -88,7 +88,7 @@ public struct Indexed where T: Indexable { /// You should not reach for this directly, and instead use the @``Indexed`` property wrapper. public struct _AnyIndexed { var indexedType: String - var indexed: any _Indexed + var indexed: any _IndexedProtocol init(indexed: Indexed) { self.indexed = indexed @@ -97,7 +97,7 @@ public struct _AnyIndexed { } /// An internal protocol to use when evaluating types for indexed properties. -protocol _Indexed: Indexable { +protocol _IndexedProtocol: Indexable { associatedtype T: Indexable init(wrappedValue: T) @@ -106,7 +106,7 @@ protocol _Indexed: Indexable { var projectedValue: _AnyIndexed { get } } -extension _Indexed { +extension _IndexedProtocol { public init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() let wrappedValue = try container.decode(T.self) @@ -123,5 +123,5 @@ extension _Indexed { public static func == (lhs: Self, rhs: Self) -> Bool { lhs.wrappedValue == rhs.wrappedValue } } -extension Indexed: _Indexed { +extension Indexed: _IndexedProtocol { } diff --git a/Tests/CodableDatastoreTests/IndexedTests.swift b/Tests/CodableDatastoreTests/IndexedTests.swift index 6610605..9730120 100644 --- a/Tests/CodableDatastoreTests/IndexedTests.swift +++ b/Tests/CodableDatastoreTests/IndexedTests.swift @@ -47,7 +47,7 @@ final class IndexedTests: XCTestCase { // for child in mirror.children { // guard let label = child.label else { continue } // let childType = type(of: child.value) -// guard childType is _Indexed.Type else { continue } +// guard childType is _IndexedProtocol.Type else { continue } // print("Child: \(label), type: \(childType)") // indexedProperties.append(label) // } @@ -61,7 +61,7 @@ final class IndexedTests: XCTestCase { for child in mirror.children { guard let label = child.label else { continue } let childType = type(of: child.value) - guard childType is any _Indexed.Type else { continue } + guard childType is any _IndexedProtocol.Type else { continue } indexedProperties.append(label) } XCTAssertEqual(indexedProperties, ["_name", "_age"])