From 16c5bb3e15cb94684d9c3f574cff381033939159 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Mon, 27 Jul 2026 15:23:39 +0900 Subject: [PATCH] Rename DynamicObjectID -> PersistentID --- CoreStore.xcodeproj/project.pbxproj | 48 ++++++------- ... OSX.xcscheme => CoreStore macOS.xcscheme} | 10 +-- .../Advanced.EvolutionDemo.Migrator.swift | 6 ++ .../Modern.PokedexDemo.Service.swift | 10 +-- Demo/Sources/Helpers/Menu/Menu.MainView.swift | 27 ++++++- Sources/AsynchronousDataTransaction.swift | 16 ++--- Sources/BaseDataTransaction+Querying.swift | 10 +-- Sources/BaseDataTransaction.swift | 19 +++-- Sources/CoreStore+Logging.swift | 2 +- Sources/CoreStoreLogger.swift | 2 +- Sources/DataStack+Querying.swift | 10 +-- Sources/DefaultLogger.swift | 72 +++++++++---------- Sources/Differentiable.swift | 2 +- Sources/DynamicObject.swift | 2 +- Sources/Field.Relationship.swift | 2 +- ...Internals.DiffableDataSourceSnapshot.swift | 2 +- Sources/MigrationResult.swift | 2 +- Sources/NSManagedObjectContext+Querying.swift | 4 +- ...namicObjectID.swift => PersistentID.swift} | 2 +- Sources/Relationship.ToManyOrdered.swift | 2 +- Sources/Relationship.ToManyUnordered.swift | 2 +- Sources/SetupResult.swift | 2 +- Sources/SynchronousDataTransaction.swift | 12 ++-- 23 files changed, 146 insertions(+), 120 deletions(-) rename CoreStore.xcodeproj/xcshareddata/xcschemes/{CoreStore OSX.xcscheme => CoreStore macOS.xcscheme} (93%) rename Sources/{DynamicObjectID.swift => PersistentID.swift} (97%) diff --git a/CoreStore.xcodeproj/project.pbxproj b/CoreStore.xcodeproj/project.pbxproj index ca9e981..c812256 100644 --- a/CoreStore.xcodeproj/project.pbxproj +++ b/CoreStore.xcodeproj/project.pbxproj @@ -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 = ""; }; 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 = ""; }; - 5F13955D2FFCDBAC001EE0A4 /* DynamicObjectID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicObjectID.swift; sourceTree = ""; }; + 5F13955D2FFCDBAC001EE0A4 /* PersistentID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistentID.swift; sourceTree = ""; }; 5F17507D2FFE35AB00BA577F /* Internals.Mutext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Internals.Mutext.swift; sourceTree = ""; }; 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 */, diff --git a/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme b/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore macOS.xcscheme similarity index 93% rename from CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme rename to CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore macOS.xcscheme index 7a7d9b2..0250c73 100644 --- a/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme +++ b/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore macOS.xcscheme @@ -16,7 +16,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE" BuildableName = "CoreStore.framework" - BlueprintName = "CoreStore OSX" + BlueprintName = "CoreStore macOS" ReferencedContainer = "container:CoreStore.xcodeproj"> @@ -32,7 +32,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE" BuildableName = "CoreStore.framework" - BlueprintName = "CoreStore OSX" + BlueprintName = "CoreStore macOS" ReferencedContainer = "container:CoreStore.xcodeproj"> @@ -43,7 +43,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "B52DD17C1BE1F8CC00949AFE" BuildableName = "CoreStoreTests.xctest" - BlueprintName = "CoreStoreTests OSX" + BlueprintName = "CoreStoreTests macOS" ReferencedContainer = "container:CoreStore.xcodeproj"> @@ -64,7 +64,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE" BuildableName = "CoreStore.framework" - BlueprintName = "CoreStore OSX" + BlueprintName = "CoreStore macOS" ReferencedContainer = "container:CoreStore.xcodeproj"> @@ -80,7 +80,7 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "B52DD1731BE1F8CC00949AFE" BuildableName = "CoreStore.framework" - BlueprintName = "CoreStore OSX" + BlueprintName = "CoreStore macOS" ReferencedContainer = "container:CoreStore.xcodeproj"> diff --git a/Demo/Sources/Demos/Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift b/Demo/Sources/Demos/Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift index 6c906c1..f9787a1 100644 --- a/Demo/Sources/Demos/Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift +++ b/Demo/Sources/Demos/Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift @@ -37,12 +37,18 @@ extension Advanced.EvolutionDemo { modelVersion: Advanced.EvolutionDemo.V3.name, entities: [ Entity("Creature") + ], + versionLock: [ + "Creature": [0x23cc88fece8e3ee0, 0xe37ecbcbe52eab30, 0xd3cc2e5f39a37f16, 0x79feebe14f602495] ] ), CoreStoreSchema( modelVersion: Advanced.EvolutionDemo.V4.name, entities: [ Entity("Creature") + ], + versionLock: [ + "Creature": [0xe7eaceec2a84d084, 0xac104aa167d8afe8, 0x6651e5ece419d490, 0xf73ec7f3512197de] ] ) ], diff --git a/Demo/Sources/Demos/Modern/PokedexDemo/Modern.PokedexDemo.Service.swift b/Demo/Sources/Demos/Modern/PokedexDemo/Modern.PokedexDemo.Service.swift index 0729f13..e64ac30 100644 --- a/Demo/Sources/Demos/Modern/PokedexDemo/Modern.PokedexDemo.Service.swift +++ b/Demo/Sources/Demos/Modern/PokedexDemo/Modern.PokedexDemo.Service.swift @@ -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, + for detailsPersistentID: PersistentID, from data: Data ) async throws -> ObjectSnapshot { @@ -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, + for detailsPersistentID: PersistentID, from dataArray: [Data] ) async throws { @@ -289,7 +289,7 @@ extension Modern.PokedexDemo { private func fetchSpecies( key: String, - detailsPersistentID: DynamicObjectID, + detailsPersistentID: PersistentID, speciesURL: URL ) async { @@ -331,7 +331,7 @@ extension Modern.PokedexDemo { private func fetchFormsIfNeeded( key: String, - detailsPersistentID: DynamicObjectID, + detailsPersistentID: PersistentID, species: ObjectSnapshot ) { @@ -363,7 +363,7 @@ extension Modern.PokedexDemo { } private func fetchForms( - detailsPersistentID: DynamicObjectID, + detailsPersistentID: PersistentID, formsURLs: [URL] ) async { diff --git a/Demo/Sources/Helpers/Menu/Menu.MainView.swift b/Demo/Sources/Helpers/Menu/Menu.MainView.swift index b7406e5..946f464 100644 --- a/Demo/Sources/Helpers/Menu/Menu.MainView.swift +++ b/Demo/Sources/Helpers/Menu/Menu.MainView.swift @@ -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: View { + + init(@ViewBuilder content: @escaping () -> Content) { + + self.content = content + } + + var body: some View { + + self.content() + } + + private let content: () -> Content + } } } diff --git a/Sources/AsynchronousDataTransaction.swift b/Sources/AsynchronousDataTransaction.swift index eafe416..62d48d3 100644 --- a/Sources/AsynchronousDataTransaction.swift +++ b/Sources/AsynchronousDataTransaction.swift @@ -55,7 +55,7 @@ public nonisolated final class AsynchronousDataTransaction: BaseDataTransaction `Result.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.failure` indicates that the transaction either failed or was cancelled. The associated object for this value is a `CoreStoreError` enum value. */ - public typealias Result = Swift.Result + public typealias Result = Swift::Result // 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( - _ persistentID: DynamicObjectID? + _ persistentID: PersistentID? ) -> 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( _ into: Into, - _ persistentID: DynamicObjectID + _ persistentID: PersistentID ) -> O? { Internals.assert( @@ -163,7 +163,7 @@ public nonisolated final class AsynchronousDataTransaction: BaseDataTransaction */ public override func delete( persistentIDs: S - ) where S.Iterator.Element == DynamicObjectID { + ) where S.Iterator.Element == PersistentID { Internals.assert( !self.isCommitted, diff --git a/Sources/BaseDataTransaction+Querying.swift b/Sources/BaseDataTransaction+Querying.swift index 78a217a..5c1f282 100644 --- a/Sources/BaseDataTransaction+Querying.swift +++ b/Sources/BaseDataTransaction+Querying.swift @@ -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( - _ persistentID: DynamicObjectID + _ persistentID: PersistentID ) -> 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( _ objectIDs: S - ) -> [O] where S.Iterator.Element == DynamicObjectID { + ) -> [O] where S.Iterator.Element == PersistentID { return self.context.fetchExisting(objectIDs) } diff --git a/Sources/BaseDataTransaction.swift b/Sources/BaseDataTransaction.swift index a890c1e..18168f0 100644 --- a/Sources/BaseDataTransaction.swift +++ b/Sources/BaseDataTransaction.swift @@ -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( - _ persistentID: DynamicObjectID? + _ persistentID: PersistentID? ) -> 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( _ into: Into, - _ persistentID: DynamicObjectID + _ persistentID: PersistentID ) -> 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( persistentIDs: S - ) where S.Iterator.Element == DynamicObjectID { + ) where S.Iterator.Element == PersistentID { Internals.assert( self.isRunningInAllowedQueue(), diff --git a/Sources/CoreStore+Logging.swift b/Sources/CoreStore+Logging.swift index 242cfcc..5d9b034 100644 --- a/Sources/CoreStore+Logging.swift +++ b/Sources/CoreStore+Logging.swift @@ -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)) } } diff --git a/Sources/CoreStoreLogger.swift b/Sources/CoreStoreLogger.swift index 7e6c117..0bf0a5c 100644 --- a/Sources/CoreStoreLogger.swift +++ b/Sources/CoreStoreLogger.swift @@ -124,6 +124,6 @@ extension CoreStoreLogger { functionName: StaticString ) { - Swift.fatalError(message, file: fileName, line: UInt(lineNumber)) + Swift::fatalError(message, file: fileName, line: UInt(lineNumber)) } } diff --git a/Sources/DataStack+Querying.swift b/Sources/DataStack+Querying.swift index f1cbb59..572949c 100644 --- a/Sources/DataStack+Querying.swift +++ b/Sources/DataStack+Querying.swift @@ -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( - _ persistentID: DynamicObjectID + _ persistentID: PersistentID ) -> 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( _ objectIDs: S - ) -> [O] where S.Iterator.Element == DynamicObjectID { + ) -> [O] where S.Iterator.Element == PersistentID { return self.mainContext.fetchExisting(objectIDs) } diff --git a/Sources/DefaultLogger.swift b/Sources/DefaultLogger.swift index 438f692..e156369 100644 --- a/Sources/DefaultLogger.swift +++ b/Sources/DefaultLogger.swift @@ -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)) } } diff --git a/Sources/Differentiable.swift b/Sources/Differentiable.swift index 6a5a442..e3f6c14 100644 --- a/Sources/Differentiable.swift +++ b/Sources/Differentiable.swift @@ -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 } diff --git a/Sources/DynamicObject.swift b/Sources/DynamicObject.swift index 2448ce0..7293326 100644 --- a/Sources/DynamicObject.swift +++ b/Sources/DynamicObject.swift @@ -38,7 +38,7 @@ public nonisolated protocol DynamicObject: AnyObject, SendableMetatype { /** The object ID for this instance */ - typealias ObjectID = DynamicObjectID + typealias ObjectID = PersistentID /** diff --git a/Sources/Field.Relationship.swift b/Sources/Field.Relationship.swift index 7e985d7..9495340 100644 --- a/Sources/Field.Relationship.swift +++ b/Sources/Field.Relationship.swift @@ -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, diff --git a/Sources/Internals.DiffableDataSourceSnapshot.swift b/Sources/Internals.DiffableDataSourceSnapshot.swift index 9a5d4c9..5d3a0fb 100644 --- a/Sources/Internals.DiffableDataSourceSnapshot.swift +++ b/Sources/Internals.DiffableDataSourceSnapshot.swift @@ -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 ) } diff --git a/Sources/MigrationResult.swift b/Sources/MigrationResult.swift index 9943d9c..b95b748 100644 --- a/Sources/MigrationResult.swift +++ b/Sources/MigrationResult.swift @@ -43,4 +43,4 @@ import Foundation } ``` */ -public typealias MigrationResult = Swift.Result<[MigrationType], CoreStoreError> +public typealias MigrationResult = Swift::Result<[MigrationType], CoreStoreError> diff --git a/Sources/NSManagedObjectContext+Querying.swift b/Sources/NSManagedObjectContext+Querying.swift index 531dacf..6cac077 100644 --- a/Sources/NSManagedObjectContext+Querying.swift +++ b/Sources/NSManagedObjectContext+Querying.swift @@ -78,7 +78,7 @@ extension NSManagedObjectContext: FetchableSource, QueryableSource { @nonobjc public func fetchExisting( - _ persistentID: DynamicObjectID + _ persistentID: PersistentID ) -> O? { return self.fetchExisting(persistentID.managedObjectID) @@ -111,7 +111,7 @@ extension NSManagedObjectContext: FetchableSource, QueryableSource { @nonobjc public func fetchExisting( _ persistentIDs: S - ) -> [O] where S.Iterator.Element == DynamicObjectID { + ) -> [O] where S.Iterator.Element == PersistentID { return persistentIDs.compactMap({ self.fetchExisting($0.managedObjectID) }) } diff --git a/Sources/DynamicObjectID.swift b/Sources/PersistentID.swift similarity index 97% rename from Sources/DynamicObjectID.swift rename to Sources/PersistentID.swift index 0959c65..2a745b6 100644 --- a/Sources/DynamicObjectID.swift +++ b/Sources/PersistentID.swift @@ -28,7 +28,7 @@ import CoreData // MARK: - DynamicObjectID -public struct DynamicObjectID: Hashable, ObjectRepresentation, Sendable { +public struct PersistentID: Hashable, ObjectRepresentation, Sendable { /** The associated `NSManagedObject` or `CoreStoreObject` entity class diff --git a/Sources/Relationship.ToManyOrdered.swift b/Sources/Relationship.ToManyOrdered.swift index 10bfeee..da4e772 100644 --- a/Sources/Relationship.ToManyOrdered.swift +++ b/Sources/Relationship.ToManyOrdered.swift @@ -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, diff --git a/Sources/Relationship.ToManyUnordered.swift b/Sources/Relationship.ToManyUnordered.swift index fe3818f..21dd0c8 100644 --- a/Sources/Relationship.ToManyUnordered.swift +++ b/Sources/Relationship.ToManyUnordered.swift @@ -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, diff --git a/Sources/SetupResult.swift b/Sources/SetupResult.swift index 27c0940..473de0b 100644 --- a/Sources/SetupResult.swift +++ b/Sources/SetupResult.swift @@ -47,4 +47,4 @@ import CoreData ) ``` */ -public typealias SetupResult = Swift.Result where StorageInterfaceType: StorageInterface +public typealias SetupResult = Swift::Result where StorageInterfaceType: StorageInterface diff --git a/Sources/SynchronousDataTransaction.swift b/Sources/SynchronousDataTransaction.swift index f20e395..965bfe3 100644 --- a/Sources/SynchronousDataTransaction.swift +++ b/Sources/SynchronousDataTransaction.swift @@ -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( - _ persistentID: DynamicObjectID? + _ persistentID: PersistentID? ) -> 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( _ into: Into, - _ persistentID: DynamicObjectID + _ persistentID: PersistentID ) -> O? { Internals.assert( @@ -150,7 +150,7 @@ public nonisolated final class SynchronousDataTransaction: BaseDataTransaction { */ public override func delete( persistentIDs: S - ) where S.Iterator.Element == DynamicObjectID { + ) where S.Iterator.Element == PersistentID { Internals.assert( !self.isCommitted,