diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj index 2d4cadc..b538ea7 100644 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -102,7 +102,7 @@ B5D6F1FE250E0B3F00DF5D2F /* Advanced.EvolutionDemo.GeologicalPeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F1FD250E0B3F00DF5D2F /* Advanced.EvolutionDemo.GeologicalPeriod.swift */; }; B5D6F205250E0DD600DF5D2F /* Advanced.EvolutionDemo.V3.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F204250E0DD600DF5D2F /* Advanced.EvolutionDemo.V3.swift */; }; B5D6F207250E0E3B00DF5D2F /* Advanced.EvolutionDemo.V4.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F206250E0E3B00DF5D2F /* Advanced.EvolutionDemo.V4.swift */; }; - B5D6F209250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F208250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift */; }; + B5D6F209250E14AA00DF5D2F /* ⭐️Advanced.EvolutionDemo.Migrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F208250E14AA00DF5D2F /* ⭐️Advanced.EvolutionDemo.Migrator.swift */; }; B5D6F210250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F20E250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodeld */; }; B5E32C9024FA41F9003F46AD /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E32C8F24FA41F9003F46AD /* ImageDownloader.swift */; }; /* End PBXBuildFile section */ @@ -219,7 +219,7 @@ B5D6F1FD250E0B3F00DF5D2F /* Advanced.EvolutionDemo.GeologicalPeriod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.GeologicalPeriod.swift; sourceTree = ""; }; B5D6F204250E0DD600DF5D2F /* Advanced.EvolutionDemo.V3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V3.swift; sourceTree = ""; }; B5D6F206250E0E3B00DF5D2F /* Advanced.EvolutionDemo.V4.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V4.swift; sourceTree = ""; }; - B5D6F208250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.Migrator.swift; sourceTree = ""; }; + B5D6F208250E14AA00DF5D2F /* ⭐️Advanced.EvolutionDemo.Migrator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "⭐️Advanced.EvolutionDemo.Migrator.swift"; sourceTree = ""; }; B5D6F20F250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Advanced.EvolutionDemo.V1.xcdatamodel; sourceTree = ""; }; B5D6F211250E1E7000DF5D2F /* Advanced.EvolutionDemo.V2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Advanced.EvolutionDemo.V2.xcdatamodel; sourceTree = ""; }; B5E32C8F24FA41F9003F46AD /* ImageDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageDownloader.swift; sourceTree = ""; }; @@ -515,21 +515,12 @@ isa = PBXGroup; children = ( B5A543F524FBF13A000DC5E3 /* Advanced.swift */, - B5A543F7250482D8000DC5E3 /* Accounts */, - B5A543F8250482EF000DC5E3 /* EvolutionDemo */, - B5A543F9250482F7000DC5E3 /* Logger */, + B5A543F8250482EF000DC5E3 /* ⭐️EvolutionDemo */, ); path = "⭐️Advanced"; sourceTree = ""; }; - B5A543F7250482D8000DC5E3 /* Accounts */ = { - isa = PBXGroup; - children = ( - ); - path = Accounts; - sourceTree = ""; - }; - B5A543F8250482EF000DC5E3 /* EvolutionDemo */ = { + B5A543F8250482EF000DC5E3 /* ⭐️EvolutionDemo */ = { isa = PBXGroup; children = ( B5A543FA2504840E000DC5E3 /* Advanced.EvolutionDemo.swift */, @@ -537,27 +528,12 @@ B5A543FE250487B1000DC5E3 /* Advanced.EvolutionDemo.MainView.swift */, B5A54400250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift */, B5A54402250487D4000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift */, - B5D6F208250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift */, + B5D6F208250E14AA00DF5D2F /* ⭐️Advanced.EvolutionDemo.Migrator.swift */, B5C18F3225138700001BEFB3 /* Advanced.EvolutionDemo.ProgressView.swift */, B54D2F842511B70B004BEC7D /* Advanced.EvolutionDemo.CreaturesDataSource.swift */, B5A543FD25048794000DC5E3 /* Models */, ); - path = EvolutionDemo; - sourceTree = ""; - }; - B5A543F9250482F7000DC5E3 /* Logger */ = { - isa = PBXGroup; - children = ( - B5A543FC2504876F000DC5E3 /* Models */, - ); - path = Logger; - sourceTree = ""; - }; - B5A543FC2504876F000DC5E3 /* Models */ = { - isa = PBXGroup; - children = ( - ); - name = Models; + path = "⭐️EvolutionDemo"; sourceTree = ""; }; B5A543FD25048794000DC5E3 /* Models */ = { @@ -714,7 +690,7 @@ B5A54403250487D5000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift in Sources */, B5A54401250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift in Sources */, B5A543FF250487B1000DC5E3 /* Advanced.EvolutionDemo.MainView.swift in Sources */, - B5D6F209250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift in Sources */, + B5D6F209250E14AA00DF5D2F /* ⭐️Advanced.EvolutionDemo.Migrator.swift in Sources */, B5C18F3325138700001BEFB3 /* Advanced.EvolutionDemo.ProgressView.swift in Sources */, B5D6F1F8250E07FD00DF5D2F /* Advanced.EvolutionDemo.V1.swift in Sources */, B5D6F210250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodeld in Sources */, @@ -793,14 +769,14 @@ B5A3911324E5424E00E7E8BD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; }; name = Debug; }; B5A3911424E5424E00E7E8BD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; }; name = Release; }; diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift deleted file mode 100644 index 5ffe60b..0000000 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Demo -// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. - -// MARK: - Advanced - -extension Advanced { - - // MARK: - Advanced.EvolutionDemo - - /** - Sample execution of progressive migrations. This demo also shows how to do two-way migration chains (upgrades+downgrades), while allowing the app to use any version of the model. - */ - enum EvolutionDemo {} -} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreaturesDataSource.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.CreaturesDataSource.swift similarity index 98% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreaturesDataSource.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.CreaturesDataSource.swift index 127000c..ead93d3 100644 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreaturesDataSource.swift +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.CreaturesDataSource.swift @@ -12,6 +12,9 @@ extension Advanced.EvolutionDemo { // MARK: - Advanced.EvolutionDemo.CreaturesDataSource + /** + A type-erasing adapter to support different `ListPublisher` types + */ final class CreaturesDataSource: ObservableObject { // MARK: Internal diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.ItemView.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.ItemView.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.ItemView.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.ItemView.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.ListView.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.ListView.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.ListView.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.ListView.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.MainView.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.MainView.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.MainView.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.MainView.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.ProgressView.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.ProgressView.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.ProgressView.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.ProgressView.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.xcmappingmodel/xcmapping.xml b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.xcmappingmodel/xcmapping.xml similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.xcmappingmodel/xcmapping.xml rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.FromV2.xcmappingmodel/xcmapping.xml diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V1.xcdatamodel/contents b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V1.xcdatamodel/contents similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V1.xcdatamodel/contents rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V1.xcdatamodel/contents diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.xcmappingmodel/xcmapping.xml b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.xcmappingmodel/xcmapping.xml similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.xcmappingmodel/xcmapping.xml rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1.xcmappingmodel/xcmapping.xml diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1MigrationPolicy.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1MigrationPolicy.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1MigrationPolicy.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV1MigrationPolicy.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV3.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV3.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.FromV3.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.FromV3.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V2.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.FromV2.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.FromV2.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.FromV2.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.FromV2.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.FromV4.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.FromV4.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.FromV4.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.FromV4.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V3.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.FromV3.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V4.FromV3.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.FromV3.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V4.FromV3.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V4.swift similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.V4.swift diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.swift new file mode 100644 index 0000000..9ff3525 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.swift @@ -0,0 +1,24 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +// MARK: - Advanced + +extension Advanced { + + // MARK: - Advanced.EvolutionDemo + + /** + Sample execution of progressive migrations. This example demonstrates the following concepts: + + - How to inspect the current model version of the store (if it exists) + - How to do two-way migration chains (upgrades + downgrades) + - How to support multiple versions of the model on the same app + - How to migrate between `NSManagedObject` schema (`xcdatamodel` files) and `CoreStoreObject` schema. + - How to use `XcodeSchemaMappingProvider`s for `NSManagedObject` stores, and `CustomSchemaMappingProvider`s for `CoreStoreObject` stores + - How to manage migration models using namespacing technique + + Note that ideally, your app should be supporting just the latest version of the model, and provide one-way progressive migrations from all the earlier versions. + */ + enum EvolutionDemo {} +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.xcdatamodel/contents b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.xcdatamodel/contents similarity index 100% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.xcdatamodel/contents rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.xcdatamodel/contents diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/⭐️Advanced.EvolutionDemo.Migrator.swift similarity index 89% rename from Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift rename to Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/⭐️Advanced.EvolutionDemo.Migrator.swift index b0b21b0..2ae71ca 100644 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/⭐️EvolutionDemo/⭐️Advanced.EvolutionDemo.Migrator.swift @@ -73,6 +73,28 @@ extension Advanced.EvolutionDemo { ) } + /** + ⭐️ Sample 3: Find the model version used by an existing `SQLiteStore`, or just return the latest version if the store is not created yet. + */ + private func findCurrentVersion() -> ModelVersion { + + let allVersions = Advanced.EvolutionDemo.GeologicalPeriod.allCases + .map({ $0.version }) + + // Since we are only interested in finding current version, we'll assume an upgrading `MigrationChain` + let dataStack = self.createDataStack( + exactCurrentModelVersion: nil, + migrationChain: MigrationChain(allVersions) + ) + let migrations = try! dataStack.requiredMigrationsForStorage( + self.accessSQLiteStore() + ) + + // If no migrations are needed, it means either the store is not created yet, or the store is already at the latest model version. In either case, we already know that the store will use the latest version + return migrations.first?.sourceVersion + ?? allVersions.last! + } + // MARK: Internal @@ -111,25 +133,14 @@ extension Advanced.EvolutionDemo { private func synchronizeCurrentVersion() { - // Since we are only interested in finding current version, we'll assume an upgrading `MigrationChain` - let dataStack = self.createDataStack( - exactCurrentModelVersion: nil, - migrationChain: MigrationChain( - Advanced.EvolutionDemo.GeologicalPeriod.allCases.map({ $0.version }) - ) - ) - let migrations = try! dataStack.requiredMigrationsForStorage( - self.accessSQLiteStore() - ) - if let period = migrations.first - .flatMap({ Advanced.EvolutionDemo.GeologicalPeriod(rawValue: $0.sourceVersion) }) { - - self.selectModelVersion(period) - } + guard + let currentPeriod = Advanced.EvolutionDemo.GeologicalPeriod(rawValue: self.findCurrentVersion()) else { self.selectModelVersion(self.currentPeriod) + return } + self.selectModelVersion(currentPeriod) } private func selectModelVersion(_ period: Advanced.EvolutionDemo.GeologicalPeriod) { diff --git a/README.md b/README.md index 950f56d..df65475 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Unleashing the real power of Core Data with the elegance and safety of Swift

-* **Swift 5.2:** iOS 10+ / macOS 10.12+ / watchOS 3.0+ / tvOS 10.0+ +* **Swift 5.3:** iOS 10+ / macOS 10.12+ / watchOS 3.0+ / tvOS 10.0+ * Previously supported Swift versions: [Swift 3.2](https://github.com/JohnEstropia/CoreStore/tree/4.2.3), [Swift 4.2](https://github.com/JohnEstropia/CoreStore/tree/6.2.1), [Swift 5.0](https://github.com/JohnEstropia/CoreStore/tree/6.3.2), [Swift 5.1](https://github.com/JohnEstropia/CoreStore/tree/7.0.4) Upgrading from CoreStore 6.x (swift 5.0) to 7.x (Swift 5.1)? Check out the [🆕 features](#features) and make sure to read the [Change logs](https://github.com/JohnEstropia/CoreStore/releases).