Skip to content

Commit 0eba960

Browse files
committed
Merge branch '3.0-preview' into feature/fix-misnamed-property
# Conflicts: # Sources/CoreDataRepository/IdentifiedUnmanagedModel.swift # Sources/Internal/ModelsWithIntId/IdentifiableModel_Int.swift # Sources/Internal/ModelsWithUuidId/IdentifiableModel_Uuid.swift
2 parents c7b8e85 + 6a7d80f commit 0eba960

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

Sources/CoreDataRepository/IdentifiedUnmanagedModel.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import CoreData
88

99
public protocol IdentifiedUnmanagedModel: ReadableUnmanagedModel {
1010
associatedtype UnmanagedId: Equatable
11-
static var unmanagedIdAccessor: (Self) -> UnmanagedId { get }
12-
/// `NSExpression` for the `unmanagedId` property on `ManagedModel`
11+
var unmanagedId: UnmanagedId { get }
1312
static var unmanagedIdExpression: NSExpression { get }
1413
}
1514

1615
extension IdentifiedUnmanagedModel {
1716
@inlinable
1817
public func readManaged(from context: NSManagedObjectContext) throws -> ManagedModel {
19-
try Self.readManaged(id: Self.unmanagedIdAccessor(self), from: context)
18+
try Self.readManaged(id: unmanagedId, from: context)
2019
}
2120

2221
@inlinable

Sources/Internal/ModelsWithIntId/IdentifiableModel_Int.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ extension IdentifiableModel_IntId: IdentifiedUnmanagedModel {
100100
}
101101

102102
@inlinable
103-
package static var unmanagedIdAccessor: (IdentifiableModel_IntId) -> Int { \.id }
103+
package var unmanagedId: Int {
104+
id
105+
}
106+
104107
package nonisolated(unsafe) static let unmanagedIdExpression = NSExpression(forKeyPath: \ManagedModel_IntId.id)
105108
}
106109

Sources/Internal/ModelsWithUuidId/IdentifiableModel_Uuid.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ extension IdentifiableModel_UuidId: IdentifiedUnmanagedModel {
100100
}
101101

102102
@inlinable
103-
package static var unmanagedIdAccessor: (IdentifiableModel_UuidId) -> UUID { \.id }
103+
package var unmanagedId: UUID {
104+
id
105+
}
106+
104107
package nonisolated(unsafe) static let unmanagedIdExpression = NSExpression(forKeyPath: \ManagedModel_UuidId.id)
105108
}
106109

0 commit comments

Comments
 (0)