Rename DynamicObjectID -> PersistentID

This commit is contained in:
John Estropia
2026-07-27 15:23:39 +09:00
parent 13093d72d4
commit 16c5bb3e15
23 changed files with 146 additions and 120 deletions
+24 -24
View File
@@ -19,10 +19,10 @@
53EB03E72A3AD5D400179430 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53EB03E52A3AD5D400179430 /* Operators.swift */; };
53EB03E82A3AD5D400179430 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53EB03E52A3AD5D400179430 /* Operators.swift */; };
53EB03E92A3AD5D400179430 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53EB03E52A3AD5D400179430 /* Operators.swift */; };
5F13955E2FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */; };
5F13955F2FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */; };
5F1395602FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */; };
5F1395612FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */; };
5F13955E2FFCDBEF001EE0A4 /* PersistentID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */; };
5F13955F2FFCDBEF001EE0A4 /* PersistentID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */; };
5F1395602FFCDBEF001EE0A4 /* PersistentID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */; };
5F1395612FFCDBEF001EE0A4 /* PersistentID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */; };
5F17507E2FFE35AF00BA577F /* Internals.Mutext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F17507D2FFE35AB00BA577F /* Internals.Mutext.swift */; };
5F17507F2FFE35AF00BA577F /* Internals.Mutext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F17507D2FFE35AB00BA577F /* Internals.Mutext.swift */; };
5F1750802FFE35AF00BA577F /* Internals.Mutext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F17507D2FFE35AB00BA577F /* Internals.Mutext.swift */; };
@@ -872,7 +872,7 @@
containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = B52DD1731BE1F8CC00949AFE;
remoteInfo = "CoreStore OSX";
remoteInfo = "CoreStore macOS";
};
B5D372871A39CF4D00F583D9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -891,7 +891,7 @@
2F03A53E19C5C6DA005002A5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2F03A54C19C5C872005002A5 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
53EB03E52A3AD5D400179430 /* Operators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicObjectID.swift; sourceTree = "<group>"; };
5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistentID.swift; sourceTree = "<group>"; };
5F17507D2FFE35AB00BA577F /* Internals.Mutext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Internals.Mutext.swift; sourceTree = "<group>"; };
82BA18891C4BBCBA00A0916E /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
82BA18921C4BBCBA00A0916E /* CoreStoreTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreStoreTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1463,7 +1463,7 @@
B5831B6E1F3355C300A9F647 /* Legacy Properties */,
B52F74391E9B8724005F3DAC /* Dynamic Schema */,
B5D339DC1E9489C700C880DE /* DynamicObject.swift */,
5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */,
5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */,
B52F742E1E9B50D0005F3DAC /* SchemaHistory.swift */,
B5D339E61E9493A500C880DE /* Entity.swift */,
B5A991EB1E9DC2CE0091A2E3 /* VersionLock.swift */,
@@ -1903,9 +1903,9 @@
productReference = B5114DC928CEEE5400EEAE78 /* CoreStoreTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
B52DD1731BE1F8CC00949AFE /* CoreStore OSX */ = {
B52DD1731BE1F8CC00949AFE /* CoreStore macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore OSX" */;
buildConfigurationList = B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore macOS" */;
buildPhases = (
B52DD1711BE1F8CC00949AFE /* Headers */,
B52DD16F1BE1F8CC00949AFE /* Sources */,
@@ -1916,14 +1916,14 @@
);
dependencies = (
);
name = "CoreStore OSX";
productName = "CoreStore OSX";
name = "CoreStore macOS";
productName = "CoreStore macOS";
productReference = B52DD1741BE1F8CC00949AFE /* CoreStore.framework */;
productType = "com.apple.product-type.framework";
};
B52DD17C1BE1F8CC00949AFE /* CoreStoreTests OSX */ = {
B52DD17C1BE1F8CC00949AFE /* CoreStoreTests macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = B52DD18D1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStoreTests OSX" */;
buildConfigurationList = B52DD18D1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStoreTests macOS" */;
buildPhases = (
B52DD1791BE1F8CC00949AFE /* Sources */,
B52DD17A1BE1F8CC00949AFE /* Frameworks */,
@@ -1934,8 +1934,8 @@
dependencies = (
B52DD1801BE1F8CD00949AFE /* PBXTargetDependency */,
);
name = "CoreStoreTests OSX";
productName = "CoreStore OSXTests";
name = "CoreStoreTests macOS";
productName = "CoreStore macOSTests";
productReference = B52DD17D1BE1F8CC00949AFE /* CoreStoreTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
@@ -2016,8 +2016,8 @@
82BA18911C4BBCBA00A0916E /* CoreStoreTests tvOS */,
B563216E1BD65082006C9394 /* CoreStore watchOS */,
B5114DA328CEEE5400EEAE78 /* CoreStoreTests watchOS */,
B52DD1731BE1F8CC00949AFE /* CoreStore OSX */,
B52DD17C1BE1F8CC00949AFE /* CoreStoreTests OSX */,
B52DD1731BE1F8CC00949AFE /* CoreStore macOS */,
B52DD17C1BE1F8CC00949AFE /* CoreStoreTests macOS */,
);
};
/* End PBXProject section */
@@ -2143,7 +2143,7 @@
B50E175223517C6B004F033C /* Internals.DiffableDataUIDispatcher.Changeset.swift in Sources */,
B5E84EE71AFF84610064E85B /* CoreStore+Logging.swift in Sources */,
B546F9731C9C553300D5AC55 /* SetupResult.swift in Sources */,
5F13955F2FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */,
5F13955F2FFCDBEF001EE0A4 /* PersistentID.swift in Sources */,
B50C3EFE23D1AB1400B29880 /* FieldCoders.Plist.swift in Sources */,
B56E4EDF23CEBCF000E1708C /* FieldOptionalType.swift in Sources */,
B5C7959925D7D8B300BDACC1 /* ListReader.swift in Sources */,
@@ -2362,7 +2362,7 @@
B5831F432212700400D8604C /* Where.Expression.swift in Sources */,
B51260941E9B28F100402229 /* Internals.EntityIdentifier.swift in Sources */,
B5FE4DA81C84FB4400FA6A91 /* InMemoryStore.swift in Sources */,
5F1395602FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */,
5F1395602FFCDBEF001EE0A4 /* PersistentID.swift in Sources */,
B50C3EFF23D1AB1400B29880 /* FieldCoders.Plist.swift in Sources */,
B56E4EE023CEBCF000E1708C /* FieldOptionalType.swift in Sources */,
B5C7959A25D7D8B300BDACC1 /* ListReader.swift in Sources */,
@@ -2616,7 +2616,7 @@
B52DD1AD1BE1F93900949AFE /* Where.swift in Sources */,
B5F8496F234898240029D57B /* ListSnapshot.swift in Sources */,
B5831F452212700500D8604C /* Where.Expression.swift in Sources */,
5F13955E2FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */,
5F13955E2FFCDBEF001EE0A4 /* PersistentID.swift in Sources */,
B5B866DE25E9012F00335476 /* ListPublisher+Reactive.swift in Sources */,
B514EF1423A8DB1E0093DBA4 /* DiffableDataSource.BaseAdapter.swift in Sources */,
B51260961E9B28F100402229 /* Internals.EntityIdentifier.swift in Sources */,
@@ -2835,7 +2835,7 @@
B5831F442212700500D8604C /* Where.Expression.swift in Sources */,
B50C3F0023D1AB1400B29880 /* FieldCoders.Plist.swift in Sources */,
B56E4EE123CEBCF000E1708C /* FieldOptionalType.swift in Sources */,
5F1395612FFCDBEF001EE0A4 /* DynamicObjectID.swift in Sources */,
5F1395612FFCDBEF001EE0A4 /* PersistentID.swift in Sources */,
B5C7959B25D7D8B300BDACC1 /* ListReader.swift in Sources */,
B5F8496E234898240029D57B /* ListSnapshot.swift in Sources */,
B51260951E9B28F100402229 /* Internals.EntityIdentifier.swift in Sources */,
@@ -2973,7 +2973,7 @@
};
B52DD1801BE1F8CD00949AFE /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B52DD1731BE1F8CC00949AFE /* CoreStore OSX */;
target = B52DD1731BE1F8CC00949AFE /* CoreStore macOS */;
targetProxy = B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */;
};
B5D372881A39CF4D00F583D9 /* PBXTargetDependency */ = {
@@ -3602,7 +3602,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore OSX" */ = {
B52DD18C1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStore macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B52DD1851BE1F8CD00949AFE /* Debug */,
@@ -3611,7 +3611,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B52DD18D1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStoreTests OSX" */ = {
B52DD18D1BE1F8CD00949AFE /* Build configuration list for PBXNativeTarget "CoreStoreTests macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B52DD1871BE1F8CD00949AFE /* Debug */,
@@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore OSX"
BlueprintName = "CoreStore macOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@@ -32,7 +32,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore OSX"
BlueprintName = "CoreStore macOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
@@ -43,7 +43,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B52DD17C1BE1F8CC00949AFE"
BuildableName = "CoreStoreTests.xctest"
BlueprintName = "CoreStoreTests OSX"
BlueprintName = "CoreStoreTests macOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</TestableReference>
@@ -64,7 +64,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore OSX"
BlueprintName = "CoreStore macOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
@@ -80,7 +80,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore OSX"
BlueprintName = "CoreStore macOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
@@ -37,12 +37,18 @@ extension Advanced.EvolutionDemo {
modelVersion: Advanced.EvolutionDemo.V3.name,
entities: [
Entity<Advanced.EvolutionDemo.V3.Creature>("Creature")
],
versionLock: [
"Creature": [0x23cc88fece8e3ee0, 0xe37ecbcbe52eab30, 0xd3cc2e5f39a37f16, 0x79feebe14f602495]
]
),
CoreStoreSchema(
modelVersion: Advanced.EvolutionDemo.V4.name,
entities: [
Entity<Advanced.EvolutionDemo.V4.Creature>("Creature")
],
versionLock: [
"Creature": [0xe7eaceec2a84d084, 0xac104aa167d8afe8, 0x6651e5ece419d490, 0xf73ec7f3512197de]
]
)
],
@@ -51,7 +51,7 @@ extension Modern.PokedexDemo {
Sample 2: Importing a single JSON data into an `ImportableUniqueObject` whose `ImportSource` is a JSON `Dictionary`
*/
private static func importSpecies(
for detailsPersistentID: DynamicObjectID<Modern.PokedexDemo.Details>,
for detailsPersistentID: PersistentID<Modern.PokedexDemo.Details>,
from data: Data
) async throws -> ObjectSnapshot<Modern.PokedexDemo.Species> {
@@ -88,7 +88,7 @@ extension Modern.PokedexDemo {
Sample 3: Importing a list of JSON data into `ImportableUniqueObject`s whose `ImportSource` are JSON `Dictionary`s
*/
private static func importForms(
for detailsPersistentID: DynamicObjectID<Modern.PokedexDemo.Details>,
for detailsPersistentID: PersistentID<Modern.PokedexDemo.Details>,
from dataArray: [Data]
) async throws {
@@ -289,7 +289,7 @@ extension Modern.PokedexDemo {
private func fetchSpecies(
key: String,
detailsPersistentID: DynamicObjectID<Modern.PokedexDemo.Details>,
detailsPersistentID: PersistentID<Modern.PokedexDemo.Details>,
speciesURL: URL
) async {
@@ -331,7 +331,7 @@ extension Modern.PokedexDemo {
private func fetchFormsIfNeeded(
key: String,
detailsPersistentID: DynamicObjectID<Modern.PokedexDemo.Details>,
detailsPersistentID: PersistentID<Modern.PokedexDemo.Details>,
species: ObjectSnapshot<Modern.PokedexDemo.Species>
) {
@@ -363,7 +363,7 @@ extension Modern.PokedexDemo {
}
private func fetchForms(
detailsPersistentID: DynamicObjectID<Modern.PokedexDemo.Details>,
detailsPersistentID: PersistentID<Modern.PokedexDemo.Details>,
formsURLs: [URL]
) async {
+25 -2
View File
@@ -24,15 +24,18 @@ extension Menu {
if self.horizontalSizeClass == .compact {
NavigationStack {
self.menuList
}
}
else {
NavigationSplitView(
sidebar: {
self.menuList
},
detail: {
Menu.PlaceholderView()
}
)
@@ -48,14 +51,16 @@ extension Menu {
ForEach(Menu.Section.allCases, id: \.self) { section in
SwiftUI.Section(
SwiftUI::Section(
content: {
ForEach(section.routes) { route in
NavigationLink(
destination: {
route.destination
LazyDestination {
route.destination
}
},
label: {
Menu.ItemView(
@@ -78,5 +83,23 @@ extension Menu {
.navigationTitle("CoreStore Demos")
.listStyle(.sidebar)
}
// MARK: - LazyDestination
private struct LazyDestination<Content: View>: View {
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content
}
var body: some View {
self.content()
}
private let content: () -> Content
}
}
}
+8 -8
View File
@@ -55,7 +55,7 @@ public nonisolated final class AsynchronousDataTransaction: BaseDataTransaction
`Result<T>.success` indicates that the transaction succeeded, either because the save succeeded or because there were no changes to save. The associated `userInfo` is the value returned from the transaction closure.
`Result<T>.failure` indicates that the transaction either failed or was cancelled. The associated object for this value is a `CoreStoreError` enum value.
*/
public typealias Result<UserInfoType> = Swift.Result<UserInfoType, CoreStoreError>
public typealias Result<UserInfoType> = Swift::Result<UserInfoType, CoreStoreError>
// MARK: -
@@ -80,14 +80,14 @@ public nonisolated final class AsynchronousDataTransaction: BaseDataTransaction
}
/**
Returns an editable proxy of the object with the specified `DynamicObjectID`.
Returns an editable proxy of the object with the specified `PersistentID`.
- parameter into: an `Into` clause specifying the entity type
- parameter persistentID: the `DynamicObjectID` for the object to be edited
- parameter persistentID: the `PersistentID` for the object to be edited
- returns: an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.
*/
public override func edit<O>(
_ persistentID: DynamicObjectID<O>?
_ persistentID: PersistentID<O>?
) -> O? {
Internals.assert(
@@ -117,15 +117,15 @@ public nonisolated final class AsynchronousDataTransaction: BaseDataTransaction
}
/**
Returns an editable proxy of the object with the specified `DynamicObjectID`.
Returns an editable proxy of the object with the specified `PersistentID`.
- parameter into: an `Into` clause specifying the entity type
- parameter persistentID: the `DynamicObjectID` for the object to be edited
- parameter persistentID: the `PersistentID` for the object to be edited
- returns: an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.
*/
public override func edit<O>(
_ into: Into<O>,
_ persistentID: DynamicObjectID<O>
_ persistentID: PersistentID<O>
) -> O? {
Internals.assert(
@@ -163,7 +163,7 @@ public nonisolated final class AsynchronousDataTransaction: BaseDataTransaction
*/
public override func delete<O: DynamicObject, S: Sequence>(
persistentIDs: S
) where S.Iterator.Element == DynamicObjectID<O> {
) where S.Iterator.Element == PersistentID<O> {
Internals.assert(
!self.isCommitted,
+5 -5
View File
@@ -113,11 +113,11 @@ extension BaseDataTransaction: FetchableSource, QueryableSource {
/**
Fetches the `DynamicObject` instance in the transaction's context from an `NSManagedObjectID`.
- parameter persistentID: the `DynamicObjectID` for the object
- parameter persistentID: the `PersistentID` for the object
- returns: the `DynamicObject` instance if the object exists in the transaction, or `nil` if not found.
*/
public func fetchExisting<O: DynamicObject>(
_ persistentID: DynamicObjectID<O>
_ persistentID: PersistentID<O>
) -> O? {
return self.context.fetchExisting(persistentID.managedObjectID)
@@ -150,14 +150,14 @@ extension BaseDataTransaction: FetchableSource, QueryableSource {
}
/**
Fetches the `DynamicObject` instances in the transaction's context from a list of `DynamicObjectID`.
Fetches the `DynamicObject` instances in the transaction's context from a list of `PersistentID`.
- parameter objectIDs: the `DynamicObjectID` array for the objects
- parameter objectIDs: the `PersistentID` array for the objects
- returns: the `DynamicObject` array for objects that exists in the transaction
*/
public func fetchExisting<O: DynamicObject, S: Sequence>(
_ objectIDs: S
) -> [O] where S.Iterator.Element == DynamicObjectID<O> {
) -> [O] where S.Iterator.Element == PersistentID<O> {
return self.context.fetchExisting(objectIDs)
}
+8 -11
View File
@@ -26,9 +26,6 @@
import Foundation
import CoreData
// MARK: - BaseDataTransaction
/**
The `BaseDataTransaction` is an abstract interface for `NSManagedObject` creates, updates, and deletes. All `BaseDataTransaction` subclasses manage a private `NSManagedObjectContext` which are direct children of the `NSPersistentStoreCoordinator`'s root `NSManagedObjectContext`. This means that all updates are saved first to the persistent store, and then propagated up to the read-only `NSManagedObjectContext`.
*/
@@ -118,11 +115,11 @@ public /*abstract*/ class BaseDataTransaction {
/**
Returns an editable proxy of a specified `NSManagedObject` or `CoreStoreObject`.
- parameter persistentID: the `DynamicObjectID` pertaining ot the `NSManagedObject` or `CoreStoreObject` type to be edited
- parameter persistentID: the `PersistentID` pertaining ot the `NSManagedObject` or `CoreStoreObject` type to be edited
- returns: an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.
*/
public func edit<O>(
_ persistentID: DynamicObjectID<O>?
_ persistentID: PersistentID<O>?
) -> O? {
Internals.assert(
@@ -158,15 +155,15 @@ public /*abstract*/ class BaseDataTransaction {
}
/**
Returns an editable proxy of the object with the specified `DynamicObjectID`.
Returns an editable proxy of the object with the specified `PersistentID`.
- parameter into: an `Into` clause specifying the entity type
- parameter persistentID: the `DynamicObjectID` for the object to be edited
- parameter persistentID: the `PersistentID` for the object to be edited
- returns: an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.
*/
public func edit<O>(
_ into: Into<O>,
_ persistentID: DynamicObjectID<O>
_ persistentID: PersistentID<O>
) -> O? {
Internals.assert(
@@ -206,13 +203,13 @@ public /*abstract*/ class BaseDataTransaction {
}
/**
Deletes the objects with the specified `DynamicObjectID`s.
Deletes the objects with the specified `PersistentID`s.
- parameter persistentIDs: the `DynamicObjectID`s of the objects to delete
- parameter persistentIDs: the `PersistentID`s of the objects to delete
*/
public func delete<O: DynamicObject, S: Sequence>(
persistentIDs: S
) where S.Iterator.Element == DynamicObjectID<O> {
) where S.Iterator.Element == PersistentID<O> {
Internals.assert(
self.isRunningInAllowedQueue(),
+1 -1
View File
@@ -100,6 +100,6 @@ extension Internals {
lineNumber: lineNumber,
functionName: functionName
)
Swift.fatalError(message, file: fileName, line: UInt(lineNumber))
Swift::fatalError(message, file: fileName, line: UInt(lineNumber))
}
}
+1 -1
View File
@@ -124,6 +124,6 @@ extension CoreStoreLogger {
functionName: StaticString
) {
Swift.fatalError(message, file: fileName, line: UInt(lineNumber))
Swift::fatalError(message, file: fileName, line: UInt(lineNumber))
}
}
+5 -5
View File
@@ -49,11 +49,11 @@ extension DataStack: FetchableSource, QueryableSource {
/**
Fetches the `DynamicObject` instance in the `DataStack`'s context from an `NSManagedObjectID`.
- parameter persistentID: the `DynamicObjectID` for the object
- parameter persistentID: the `PersistentID` for the object
- returns: the `DynamicObject` instance if the object exists in the `DataStack`, or `nil` if not found.
*/
public func fetchExisting<O: DynamicObject>(
_ persistentID: DynamicObjectID<O>
_ persistentID: PersistentID<O>
) -> O? {
return self.mainContext.fetchExisting(persistentID.managedObjectID)
@@ -86,14 +86,14 @@ extension DataStack: FetchableSource, QueryableSource {
}
/**
Fetches the `DynamicObject` instances in the `DataStack`'s context from a list of `DynamicObjectID`.
Fetches the `DynamicObject` instances in the `DataStack`'s context from a list of `PersistentID`.
- parameter objectIDs: the `DynamicObjectID` array for the objects
- parameter objectIDs: the `PersistentID` array for the objects
- returns: the `DynamicObject` array for objects that exists in the `DataStack`
*/
public func fetchExisting<O: DynamicObject, S: Sequence>(
_ objectIDs: S
) -> [O] where S.Iterator.Element == DynamicObjectID<O> {
) -> [O] where S.Iterator.Element == PersistentID<O> {
return self.mainContext.fetchExisting(objectIDs)
}
+36 -36
View File
@@ -55,29 +55,29 @@ public final class DefaultLogger: CoreStoreLogger {
functionName: StaticString
) {
#if DEBUG
let icon: String
let levelString: String
switch level {
case .trace:
icon = "🔹"
levelString = "Trace"
case .notice:
icon = "🔸"
levelString = "Notice"
case .warning:
icon = "⚠️"
levelString = "Warning"
case .fatal:
icon = ""
levelString = "Fatal"
}
Swift.print("\(icon) [CoreStore: \(levelString)] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
#endif
#if DEBUG
let icon: String
let levelString: String
switch level {
case .trace:
icon = "🔹"
levelString = "Trace"
case .notice:
icon = "🔸"
levelString = "Notice"
case .warning:
icon = "⚠️"
levelString = "Warning"
case .fatal:
icon = ""
levelString = "Fatal"
}
Swift::print("\(icon) [CoreStore: \(levelString)] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
#endif
}
/**
@@ -97,9 +97,9 @@ public final class DefaultLogger: CoreStoreLogger {
functionName: StaticString
) {
#if DEBUG
Swift.print("⚠️ [CoreStore: Error] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n \(error)\n")
#endif
#if DEBUG
Swift::print("⚠️ [CoreStore: Error] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n \(error)\n")
#endif
}
/**
@@ -119,14 +119,14 @@ public final class DefaultLogger: CoreStoreLogger {
functionName: StaticString
) {
#if DEBUG
if condition() {
return
}
Swift.print("❗ [CoreStore: Assertion Failure] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message())\n")
Swift.fatalError(file: fileName, line: UInt(lineNumber))
#endif
#if DEBUG
if condition() {
return
}
Swift::print("❗ [CoreStore: Assertion Failure] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message())\n")
Swift::fatalError(file: fileName, line: UInt(lineNumber))
#endif
}
/**
@@ -145,7 +145,7 @@ public final class DefaultLogger: CoreStoreLogger {
functionName: StaticString
) {
Swift.print("❗ [CoreStore: Fatal Error] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
Swift.fatalError(file: fileName, line: UInt(lineNumber))
Swift::print("❗ [CoreStore: Fatal Error] \((String(describing: fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
Swift::fatalError(file: fileName, line: UInt(lineNumber))
}
}
+1 -1
View File
@@ -54,7 +54,7 @@ extension Differentiable where Self: AnyObject {
@usableFromInline
internal protocol DifferentiableSection: Differentiable {
associatedtype Collection: Swift.Collection where Collection.Element: Differentiable
associatedtype Collection: Swift::Collection where Collection.Element: Differentiable
var elements: Collection { get }
+1 -1
View File
@@ -38,7 +38,7 @@ public nonisolated protocol DynamicObject: AnyObject, SendableMetatype {
/**
The object ID for this instance
*/
typealias ObjectID = DynamicObjectID<Self>
typealias ObjectID = PersistentID<Self>
/**
+1 -1
View File
@@ -235,7 +235,7 @@ extension FieldContainer {
self.keyPath = keyPath
self.entityDescriptionValues = {
let range = (Swift.max(0, minCount) ... maxCount)
let range = (Swift::max(0, minCount) ... maxCount)
return (
isToMany: isToMany,
isOrdered: isOrdered,
@@ -57,7 +57,7 @@ extension Internals {
self.structure = .init(
sections: sections,
sectionIndexTransformer: sectionIndexTransformer,
fetchOffset: Swift.max(0, fetchOffset),
fetchOffset: Swift::max(0, fetchOffset),
fetchLimit: (fetchLimit > 0) ? fetchLimit : nil
)
}
+1 -1
View File
@@ -43,4 +43,4 @@ import Foundation
}
```
*/
public typealias MigrationResult = Swift.Result<[MigrationType], CoreStoreError>
public typealias MigrationResult = Swift::Result<[MigrationType], CoreStoreError>
@@ -78,7 +78,7 @@ extension NSManagedObjectContext: FetchableSource, QueryableSource {
@nonobjc
public func fetchExisting<O: DynamicObject>(
_ persistentID: DynamicObjectID<O>
_ persistentID: PersistentID<O>
) -> O? {
return self.fetchExisting(persistentID.managedObjectID)
@@ -111,7 +111,7 @@ extension NSManagedObjectContext: FetchableSource, QueryableSource {
@nonobjc
public func fetchExisting<O: DynamicObject, S: Sequence>(
_ persistentIDs: S
) -> [O] where S.Iterator.Element == DynamicObjectID<O> {
) -> [O] where S.Iterator.Element == PersistentID<O> {
return persistentIDs.compactMap({ self.fetchExisting($0.managedObjectID) })
}
@@ -28,7 +28,7 @@ import CoreData
// MARK: - DynamicObjectID
public struct DynamicObjectID<O: DynamicObject>: Hashable, ObjectRepresentation, Sendable {
public struct PersistentID<O: DynamicObject>: Hashable, ObjectRepresentation, Sendable {
/**
The associated `NSManagedObject` or `CoreStoreObject` entity class
+1 -1
View File
@@ -203,7 +203,7 @@ extension RelationshipContainer {
self.keyPath = keyPath
self.entityDescriptionValues = {
let range = (Swift.max(0, minCount) ... maxCount)
let range = (Swift::max(0, minCount) ... maxCount)
return (
isToMany: true,
isOrdered: true,
+1 -1
View File
@@ -203,7 +203,7 @@ extension RelationshipContainer {
self.keyPath = keyPath
self.entityDescriptionValues = {
let range = (Swift.max(0, minCount) ... maxCount)
let range = (Swift::max(0, minCount) ... maxCount)
return (
isToMany: true,
isOrdered: false,
+1 -1
View File
@@ -47,4 +47,4 @@ import CoreData
)
```
*/
public typealias SetupResult<StorageInterfaceType> = Swift.Result<StorageInterfaceType, CoreStoreError> where StorageInterfaceType: StorageInterface
public typealias SetupResult<StorageInterfaceType> = Swift::Result<StorageInterfaceType, CoreStoreError> where StorageInterfaceType: StorageInterface
+6 -6
View File
@@ -71,11 +71,11 @@ public nonisolated final class SynchronousDataTransaction: BaseDataTransaction {
/**
Returns an editable proxy of a specified `NSManagedObject` or `CoreStoreObject`.
- parameter persistentID: the `DynamicObjectID` pertaining ot the `NSManagedObject` or `CoreStoreObject` type to be edited
- parameter persistentID: the `PersistentID` pertaining ot the `NSManagedObject` or `CoreStoreObject` type to be edited
- returns: an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.
*/
public override func edit<O: DynamicObject>(
_ persistentID: DynamicObjectID<O>?
_ persistentID: PersistentID<O>?
) -> O? {
Internals.assert(
@@ -104,15 +104,15 @@ public nonisolated final class SynchronousDataTransaction: BaseDataTransaction {
}
/**
Returns an editable proxy of the object with the specified `DynamicObjectID`.
Returns an editable proxy of the object with the specified `PersistentID`.
- parameter into: an `Into` clause specifying the entity type
- parameter persistentID: the `DynamicObjectID` for the object to be edited
- parameter persistentID: the `PersistentID` for the object to be edited
- returns: an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.
*/
public override func edit<O>(
_ into: Into<O>,
_ persistentID: DynamicObjectID<O>
_ persistentID: PersistentID<O>
) -> O? {
Internals.assert(
@@ -150,7 +150,7 @@ public nonisolated final class SynchronousDataTransaction: BaseDataTransaction {
*/
public override func delete<O: DynamicObject, S: Sequence>(
persistentIDs: S
) where S.Iterator.Element == DynamicObjectID<O> {
) where S.Iterator.Element == PersistentID<O> {
Internals.assert(
!self.isCommitted,