diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj index 7b52287..c71d04b 100644 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -82,10 +82,17 @@ B5A54401250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A54400250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift */; }; B5A54403250487D5000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A54402250487D4000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift */; }; B5A54405250487F5000DC5E3 /* Advanced.EvolutionDemo.CreatureType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A54404250487F5000DC5E3 /* Advanced.EvolutionDemo.CreatureType.swift */; }; - B5A5440725049480000DC5E3 /* Advanced.EvolutionDemo.CreatureV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440625049480000DC5E3 /* Advanced.EvolutionDemo.CreatureV1.swift */; }; - B5A5440925049489000DC5E3 /* Advanced.EvolutionDemo.CreatureV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440825049489000DC5E3 /* Advanced.EvolutionDemo.CreatureV2.swift */; }; - B5A5440B25049492000DC5E3 /* Advanced.EvolutionDemo.CreatureV3.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440A25049492000DC5E3 /* Advanced.EvolutionDemo.CreatureV3.swift */; }; - B5A5440D2504949C000DC5E3 /* Advanced.EvolutionDemo.CreatureV4.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440C2504949C000DC5E3 /* Advanced.EvolutionDemo.CreatureV4.swift */; }; + B5A5440725049480000DC5E3 /* Advanced.EvolutionDemo.V1.Creature.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440625049480000DC5E3 /* Advanced.EvolutionDemo.V1.Creature.swift */; }; + B5A5440925049489000DC5E3 /* Advanced.EvolutionDemo.V2.Creature.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440825049489000DC5E3 /* Advanced.EvolutionDemo.V2.Creature.swift */; }; + B5A5440B25049492000DC5E3 /* Advanced.EvolutionDemo.V3.Creature.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440A25049492000DC5E3 /* Advanced.EvolutionDemo.V3.Creature.swift */; }; + B5A5440D2504949C000DC5E3 /* Advanced.EvolutionDemo.V4.Creature.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5440C2504949C000DC5E3 /* Advanced.EvolutionDemo.V4.Creature.swift */; }; + B5D6F1F8250E07FD00DF5D2F /* Advanced.EvolutionDemo.V1.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F1F7250E07FD00DF5D2F /* Advanced.EvolutionDemo.V1.swift */; }; + B5D6F1FC250E0B1700DF5D2F /* Advanced.EvolutionDemo.V2.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D6F1FB250E0B1700DF5D2F /* Advanced.EvolutionDemo.V2.swift */; }; + 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 */; }; + 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 */ @@ -181,10 +188,18 @@ B5A54400250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.ListView.swift; sourceTree = ""; }; B5A54402250487D4000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.ItemView.swift; sourceTree = ""; }; B5A54404250487F5000DC5E3 /* Advanced.EvolutionDemo.CreatureType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.CreatureType.swift; sourceTree = ""; }; - B5A5440625049480000DC5E3 /* Advanced.EvolutionDemo.CreatureV1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.CreatureV1.swift; sourceTree = ""; }; - B5A5440825049489000DC5E3 /* Advanced.EvolutionDemo.CreatureV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.CreatureV2.swift; sourceTree = ""; }; - B5A5440A25049492000DC5E3 /* Advanced.EvolutionDemo.CreatureV3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.CreatureV3.swift; sourceTree = ""; }; - B5A5440C2504949C000DC5E3 /* Advanced.EvolutionDemo.CreatureV4.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.CreatureV4.swift; sourceTree = ""; }; + B5A5440625049480000DC5E3 /* Advanced.EvolutionDemo.V1.Creature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V1.Creature.swift; sourceTree = ""; }; + B5A5440825049489000DC5E3 /* Advanced.EvolutionDemo.V2.Creature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V2.Creature.swift; sourceTree = ""; }; + B5A5440A25049492000DC5E3 /* Advanced.EvolutionDemo.V3.Creature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V3.Creature.swift; sourceTree = ""; }; + B5A5440C2504949C000DC5E3 /* Advanced.EvolutionDemo.V4.Creature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V4.Creature.swift; sourceTree = ""; }; + B5D6F1F7250E07FD00DF5D2F /* Advanced.EvolutionDemo.V1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V1.swift; sourceTree = ""; }; + B5D6F1FB250E0B1700DF5D2F /* Advanced.EvolutionDemo.V2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Advanced.EvolutionDemo.V2.swift; sourceTree = ""; }; + 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 = ""; }; + 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 = ""; }; /* End PBXFileReference section */ @@ -496,9 +511,11 @@ isa = PBXGroup; children = ( B5A543FA2504840E000DC5E3 /* Advanced.EvolutionDemo.swift */, + B5D6F1FD250E0B3F00DF5D2F /* Advanced.EvolutionDemo.GeologicalPeriod.swift */, B5A543FE250487B1000DC5E3 /* Advanced.EvolutionDemo.MainView.swift */, B5A54400250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift */, B5A54402250487D4000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift */, + B5D6F208250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift */, B5A543FD25048794000DC5E3 /* Models */, ); path = EvolutionDemo; @@ -523,14 +540,51 @@ isa = PBXGroup; children = ( B5A54404250487F5000DC5E3 /* Advanced.EvolutionDemo.CreatureType.swift */, - B5A5440625049480000DC5E3 /* Advanced.EvolutionDemo.CreatureV1.swift */, - B5A5440825049489000DC5E3 /* Advanced.EvolutionDemo.CreatureV2.swift */, - B5A5440A25049492000DC5E3 /* Advanced.EvolutionDemo.CreatureV3.swift */, - B5A5440C2504949C000DC5E3 /* Advanced.EvolutionDemo.CreatureV4.swift */, + B5D6F20E250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodeld */, + B5D6F1F9250E08D200DF5D2F /* V1 */, + B5D6F1FA250E0AE000DF5D2F /* V2 */, + B5D6F202250E0D9C00DF5D2F /* V3 */, + B5D6F203250E0DA400DF5D2F /* V4 */, ); name = Models; sourceTree = ""; }; + B5D6F1F9250E08D200DF5D2F /* V1 */ = { + isa = PBXGroup; + children = ( + B5D6F1F7250E07FD00DF5D2F /* Advanced.EvolutionDemo.V1.swift */, + B5A5440625049480000DC5E3 /* Advanced.EvolutionDemo.V1.Creature.swift */, + ); + name = V1; + sourceTree = ""; + }; + B5D6F1FA250E0AE000DF5D2F /* V2 */ = { + isa = PBXGroup; + children = ( + B5D6F1FB250E0B1700DF5D2F /* Advanced.EvolutionDemo.V2.swift */, + B5A5440825049489000DC5E3 /* Advanced.EvolutionDemo.V2.Creature.swift */, + ); + name = V2; + sourceTree = ""; + }; + B5D6F202250E0D9C00DF5D2F /* V3 */ = { + isa = PBXGroup; + children = ( + B5D6F204250E0DD600DF5D2F /* Advanced.EvolutionDemo.V3.swift */, + B5A5440A25049492000DC5E3 /* Advanced.EvolutionDemo.V3.Creature.swift */, + ); + name = V3; + sourceTree = ""; + }; + B5D6F203250E0DA400DF5D2F /* V4 */ = { + isa = PBXGroup; + children = ( + B5D6F206250E0E3B00DF5D2F /* Advanced.EvolutionDemo.V4.swift */, + B5A5440C2504949C000DC5E3 /* Advanced.EvolutionDemo.V4.Creature.swift */, + ); + name = V4; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -602,72 +656,79 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B5A543F624FBF13A000DC5E3 /* Advanced.swift in Sources */, B5A3911D24E5429200E7E8BD /* AppDelegate.swift in Sources */, B5A3915924E685EC00E7E8BD /* Classic.swift in Sources */, - B5A54401250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift in Sources */, B5E32C9024FA41F9003F46AD /* ImageDownloader.swift in Sources */, B5A3918024E787D900E7E8BD /* InstructionsView.swift in Sources */, B5A3917C24E6A76C00E7E8BD /* LazyView.swift in Sources */, - B5A543F624FBF13A000DC5E3 /* Advanced.swift in Sources */, B5A3913424E6170500E7E8BD /* Menu.swift in Sources */, - B5A543DB24FB7513000DC5E3 /* Classic.ColorsDemo.xcdatamodeld in Sources */, B5A3915B24E685FE00E7E8BD /* Modern.swift in Sources */, - B5A543D724FB7478000DC5E3 /* Classic.ColorsDemo.swift in Sources */, B5A3911F24E5429200E7E8BD /* SceneDelegate.swift in Sources */, + B5A543FB2504840E000DC5E3 /* Advanced.EvolutionDemo.swift in Sources */, + B5A543D724FB7478000DC5E3 /* Classic.ColorsDemo.swift in Sources */, + B5A543DB24FB7513000DC5E3 /* Classic.ColorsDemo.xcdatamodeld in Sources */, B5A3915324E6537F00E7E8BD /* Menu.ItemView.swift in Sources */, B5A3912124E5429200E7E8BD /* Menu.MainView.swift in Sources */, B531EFE724EA762D005F247D /* Menu.PlaceholderView.swift in Sources */, B5A3918F24E7E06500E7E8BD /* Modern.ColorsDemo.swift in Sources */, - B5A543EF24FB84D1000DC5E3 /* Classic.ColorsDemo.LIstView.swift in Sources */, - B5A3915E24E6922E00E7E8BD /* ⭐️Modern.PlacemarksDemo.swift in Sources */, - B5A543F324FB84EC000DC5E3 /* Classic.ColorsDemo.ItemCell.swift in Sources */, B5A391B124E96AF600E7E8BD /* Modern.PokedexDemo.swift in Sources */, B5A3918324E7A21800E7E8BD /* Modern.TimeZonesDemo.swift in Sources */, + B5A3915E24E6922E00E7E8BD /* ⭐️Modern.PlacemarksDemo.swift in Sources */, + B5D6F207250E0E3B00DF5D2F /* Advanced.EvolutionDemo.V4.swift in Sources */, + B5A54405250487F5000DC5E3 /* Advanced.EvolutionDemo.CreatureType.swift in Sources */, + B5A5440725049480000DC5E3 /* Advanced.EvolutionDemo.V1.Creature.swift in Sources */, + B5D6F1FE250E0B3F00DF5D2F /* Advanced.EvolutionDemo.GeologicalPeriod.swift in Sources */, + B5A5440925049489000DC5E3 /* Advanced.EvolutionDemo.V2.Creature.swift in Sources */, + B5A5440B25049492000DC5E3 /* Advanced.EvolutionDemo.V3.Creature.swift in Sources */, + B5A5440D2504949C000DC5E3 /* Advanced.EvolutionDemo.V4.Creature.swift in Sources */, + B5A54403250487D5000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift in Sources */, + B5D6F1F8250E07FD00DF5D2F /* Advanced.EvolutionDemo.V1.swift in Sources */, + B5A54401250487C7000DC5E3 /* Advanced.EvolutionDemo.ListView.swift in Sources */, + B5A543FF250487B1000DC5E3 /* Advanced.EvolutionDemo.MainView.swift in Sources */, + B5A543E924FB84A1000DC5E3 /* Classic.ColorsDemo.DetailView.swift in Sources */, + B5A543E724FB82BB000DC5E3 /* Classic.ColorsDemo.Filter.swift in Sources */, + B5A543F324FB84EC000DC5E3 /* Classic.ColorsDemo.ItemCell.swift in Sources */, + B5D6F209250E14AA00DF5D2F /* Advanced.EvolutionDemo.Migrator.swift in Sources */, + B5A543EF24FB84D1000DC5E3 /* Classic.ColorsDemo.LIstView.swift in Sources */, + B5A543ED24FB84BE000DC5E3 /* Classic.ColorsDemo.MainView.swift in Sources */, + B5A543DD24FB78F9000DC5E3 /* Classic.ColorsDemo.Palette.swift in Sources */, B5A3919824E7E67000E7E8BD /* Modern.ColorsDemo.Filter.swift in Sources */, + B5D6F1FC250E0B1700DF5D2F /* Advanced.EvolutionDemo.V2.swift in Sources */, B5A3919224E7E0C600E7E8BD /* Modern.ColorsDemo.Palette.swift in Sources */, B5A3919E24E8EEB600E7E8BD /* Modern.ColorsDemo.SwiftUI.swift in Sources */, B5A391A024E8F00A00E7E8BD /* Modern.ColorsDemo.UIKit.swift in Sources */, - B5A543E724FB82BB000DC5E3 /* Classic.ColorsDemo.Filter.swift in Sources */, - B5A543ED24FB84BE000DC5E3 /* Classic.ColorsDemo.MainView.swift in Sources */, B5A3917E24E7728400E7E8BD /* Modern.PlacemarksDemo.Geocoder.swift in Sources */, - B5A54403250487D5000DC5E3 /* Advanced.EvolutionDemo.ItemView.swift in Sources */, B5A3916024E6925900E7E8BD /* Modern.PlacemarksDemo.MapView.swift in Sources */, B5A3916524E698C700E7E8BD /* Modern.PlacemarksDemo.Place.swift in Sources */, B566C8EE24FA1EA3001134A1 /* Modern.PokedexDemo.Details.swift in Sources */, B566C8EC24F9D694001134A1 /* Modern.PokedexDemo.ItemCell.swift in Sources */, + B5D6F210250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodeld in Sources */, B566C8E824F9D406001134A1 /* Modern.PokedexDemo.ListView.swift in Sources */, B566C8EA24F9D412001134A1 /* Modern.PokedexDemo.ListViewController.swift in Sources */, B531EFED24EB7453005F247D /* Modern.PokedexDemo.MainView.swift in Sources */, B5A3918C24E7B44B00E7E8BD /* Modern.TimeZonesDemo.ItemView.swift in Sources */, B5A3918A24E7AD1800E7E8BD /* Modern.TimeZonesDemo.ListView.swift in Sources */, B5A3918624E7A54A00E7E8BD /* Modern.TimeZonesDemo.TimeZone.swift in Sources */, - B5A391A624E8F4EA00E7E8BD /* ⭐️Modern.ColorsDemo.MainView.swift in Sources */, - B5A543FF250487B1000DC5E3 /* Advanced.EvolutionDemo.MainView.swift in Sources */, - B5A3916224E697BA00E7E8BD /* ⭐️Modern.PlacemarksDemo.MainView.swift in Sources */, - B5A54405250487F5000DC5E3 /* Advanced.EvolutionDemo.CreatureType.swift in Sources */, B5A543EB24FB84AF000DC5E3 /* ⭐️Classic.ColorsDemo.DetailViewController.swift in Sources */, - B5A543FB2504840E000DC5E3 /* Advanced.EvolutionDemo.swift in Sources */, + B5A543F124FB84DD000DC5E3 /* ⭐️Classic.ColorsDemo.ListViewController.swift in Sources */, + B5D6F205250E0DD600DF5D2F /* Advanced.EvolutionDemo.V3.swift in Sources */, + B5A391A624E8F4EA00E7E8BD /* ⭐️Modern.ColorsDemo.MainView.swift in Sources */, + B5A3916224E697BA00E7E8BD /* ⭐️Modern.PlacemarksDemo.MainView.swift in Sources */, B5A391B424E96C0A00E7E8BD /* ⭐️Modern.PokedexDemo.Form.swift in Sources */, B531EFE924EB5A53005F247D /* ⭐️Modern.PokedexDemo.PokedexEntry.swift in Sources */, B5A391BB24E970A400E7E8BD /* ⭐️Modern.PokedexDemo.PokemonType.swift in Sources */, B531EFEB24EB5ECD005F247D /* ⭐️Modern.PokedexDemo.Service.swift in Sources */, B5A391B924E96F8500E7E8BD /* ⭐️Modern.PokedexDemo.Species.swift in Sources */, - B5A5440D2504949C000DC5E3 /* Advanced.EvolutionDemo.CreatureV4.swift in Sources */, B5A3918824E7A8F900E7E8BD /* ⭐️Modern.TimeZonesDemo.MainView.swift in Sources */, B5A391AC24E9143B00E7E8BD /* Modern.ColorsDemo.UIKit.DetailView.swift in Sources */, B5A391AA24E9104300E7E8BD /* Modern.ColorsDemo.UIKit.ItemCell.swift in Sources */, B5A391A424E8F04300E7E8BD /* Modern.ColorsDemo.UIKit.ListView.swift in Sources */, - B5A543E924FB84A1000DC5E3 /* Classic.ColorsDemo.DetailView.swift in Sources */, B5A3919A24E8207A00E7E8BD /* ⭐️Modern.ColorsDemo.SwiftUI.DetailView.swift in Sources */, - B5A5440925049489000DC5E3 /* Advanced.EvolutionDemo.CreatureV2.swift in Sources */, - B5A543F124FB84DD000DC5E3 /* ⭐️Classic.ColorsDemo.ListViewController.swift in Sources */, B5A3919624E7E4AC00E7E8BD /* ⭐️Modern.ColorsDemo.SwiftUI.ItemView.swift in Sources */, B5A3919424E7E36700E7E8BD /* ⭐️Modern.ColorsDemo.SwiftUI.ListView.swift in Sources */, - B5A5440B25049492000DC5E3 /* Advanced.EvolutionDemo.CreatureV3.swift in Sources */, - B5A5440725049480000DC5E3 /* Advanced.EvolutionDemo.CreatureV1.swift in Sources */, B5A391AE24E9150F00E7E8BD /* ⭐️Modern.ColorsDemo.UIKit.DetailViewController.swift in Sources */, B5A391A224E8F01F00E7E8BD /* ⭐️Modern.ColorsDemo.UIKit.ListViewController.swift in Sources */, - B5A543DD24FB78F9000DC5E3 /* Classic.ColorsDemo.Palette.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -873,6 +934,17 @@ sourceTree = ""; versionGroupType = wrapper.xcdatamodel; }; + B5D6F20E250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + B5D6F211250E1E7000DF5D2F /* Advanced.EvolutionDemo.V2.xcdatamodel */, + B5D6F20F250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodel */, + ); + currentVersion = B5D6F20F250E1E3200DF5D2F /* Advanced.EvolutionDemo.V1.xcdatamodel */; + path = Advanced.EvolutionDemo.V1.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; /* End XCVersionGroup section */ }; rootObject = B5A3910F24E5424E00E7E8BD /* Project object */; diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift index ec91161..5f5df1d 100644 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureType.swift @@ -16,9 +16,9 @@ extension Advanced.EvolutionDemo { // MARK: - Advanced.EvolutionDemo.CreatureType -protocol Advanced_EvolutionDemo_CreatureType: CoreStoreObject, CustomStringConvertible { +protocol Advanced_EvolutionDemo_CreatureType: DynamicObject, CustomStringConvertible { var dnaCode: Int64 { get } - func mutate() + func mutate(in transaction: BaseDataTransaction) } diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV1.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV1.swift deleted file mode 100644 index 1e0207f..0000000 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV1.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// Demo -// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. - -import UIKit -import CoreStore - -// MARK: - Advanced.EvolutionDemo - -extension Advanced.EvolutionDemo { - - // MARK: - Advanced.EvolutionDemo.CreatureV1 - - final class CreatureV1: CoreStoreObject, Advanced.EvolutionDemo.CreatureType { - - // MARK: Internal - - @Field.Stored("dnaCode") - var dnaCode: Int64 = 0 - - @Field.Stored("hasHead") - var hasHead: Bool = false - - @Field.Stored("hasTail") - var hasTail: Bool = false - - @Field.Stored("numberOfFlagella") - var numberOfFlagella: Int32 = 0 - } -} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV2.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV2.swift deleted file mode 100644 index 1d5784e..0000000 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV2.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// Demo -// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. - -import UIKit -import CoreStore - -// MARK: - Advanced.EvolutionDemo - -extension Advanced.EvolutionDemo { - - // MARK: - Advanced.EvolutionDemo.CreatureV2 - - final class CreatureV2: CoreStoreObject, Advanced.EvolutionDemo.CreatureType { - - // MARK: Internal - - @Field.Stored("dnaCode") - var dnaCode: Int64 = 0 - - @Field.Stored("hasHead") - var hasHead: Bool = false - - @Field.Stored("hasTail") - var hasTail: Bool = false - - @Field.Stored("hasTail") - var numberOfFlippers: Int32 = 0 - } -} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV3.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV3.swift deleted file mode 100644 index 2215e9b..0000000 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV3.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// Demo -// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. - -import UIKit -import CoreStore - -// MARK: - Advanced.EvolutionDemo - -extension Advanced.EvolutionDemo { - - // MARK: - Advanced.EvolutionDemo.CreatureV3 - - final class CreatureV3: CoreStoreObject, Advanced.EvolutionDemo.CreatureType { - - // MARK: Internal - - @Field.Stored("dnaCode") - var dnaCode: Int64 = 0 - - @Field.Stored("hasHead") - var hasHead: Bool = false - - @Field.Stored("hasTail") - var hasTail: Bool = false - - @Field.Stored("hasTail") - var numberOfFlippers: Int32 = 0 - } -} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV4.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV4.swift deleted file mode 100644 index 927044c..0000000 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.CreatureV4.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// Demo -// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. - -import UIKit -import CoreStore - -// MARK: - Advanced.EvolutionDemo - -extension Advanced.EvolutionDemo { - - // MARK: - Advanced.EvolutionDemo.CreatureV4 - - final class CreatureV4: CoreStoreObject, Advanced.EvolutionDemo.CreatureType { - - // MARK: Internal - - @Field.Stored("dnaCode") - var dnaCode: Int64 = 0 - - @Field.Stored("hasHead") - var hasHead: Bool = false - - @Field.Stored("hasTail") - var hasTail: Bool = false - - @Field.Stored("hasTail") - var numberOfFlippers: Int32 = 0 - } -} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift new file mode 100644 index 0000000..afd50db --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.GeologicalPeriod.swift @@ -0,0 +1,35 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +// MARK: - AdvancedEvolutionDemo + +extension Advanced.EvolutionDemo { + + // MARK: - GeologicalPeriod + + enum GeologicalPeriod: CaseIterable { + + // MARK: Internal + + case ageOfInvertebrates + case ageOfFishes + case ageOfReptiles + case ageOfMammals + + var creatureType: Advanced.EvolutionDemo.CreatureType.Type { + + switch self { + + case .ageOfInvertebrates: + return Advanced.EvolutionDemo.V1.Creature.self + case .ageOfFishes: + return Advanced.EvolutionDemo.V2.Creature.self + case .ageOfReptiles: + return Advanced.EvolutionDemo.V3.Creature.self + case .ageOfMammals: + return Advanced.EvolutionDemo.V4.Creature.self + } + } + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift new file mode 100644 index 0000000..bef1d86 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.Migrator.swift @@ -0,0 +1,93 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import CoreStore +import Foundation +import Combine + + +// MARK: - Advanced.EvolutionDemo + +extension Advanced.EvolutionDemo { + + // MARK: - Advanced.EvolutionDemo.Migrator + + final class Migrator: ObservableObject { + + var currentPeriod: Advanced.EvolutionDemo.GeologicalPeriod? { + + return self.current?.period + } + + + // MARK: Private + + private var current: (period: Advanced.EvolutionDemo.GeologicalPeriod, dataStack: DataStack)? { + + willSet { + + self.objectWillChange.send() + } + } + + private func findAndSetCurrentVersion() { + + let xcodeV1ToV2ModelSchema = XcodeDataModelSchema.from( + modelName: "Advanced.EvolutionDemo.V1", + bundle: Bundle(for: Advanced.EvolutionDemo.V1.Creature.self), + migrationChain: [ + Advanced.EvolutionDemo.V1.name, + Advanced.EvolutionDemo.V2.name + ] + ) + let dataStack = DataStack( + schemaHistory: SchemaHistory( + allSchema: xcodeV1ToV2ModelSchema.allSchema + + [ + CoreStoreSchema( + modelVersion: Advanced.EvolutionDemo.V3.name, + entities: [ + Entity("Creature") + ] + ), + CoreStoreSchema( + modelVersion: Advanced.EvolutionDemo.V4.name, + entities: [ + Entity("Creature") + ] + ) + ], + migrationChain: [ + Advanced.EvolutionDemo.V1.name, + Advanced.EvolutionDemo.V2.name, + Advanced.EvolutionDemo.V3.name, + Advanced.EvolutionDemo.V4.name + ] + ) + ) + } + + private func selectModelVersion(_ period: GeologicalPeriod) { + + guard period != self.current?.period else { + + return + } + + // explicitly trigger `NSPersistentStore` cleanup by deallocating the `DataStack` + self.current = nil + + } + + + // MARK: - VersionMetadata + + private struct VersionMetadata { + + let label: String + let entityType: Advanced.EvolutionDemo.CreatureType.Type + let schemaHistory: SchemaHistory + } + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift new file mode 100644 index 0000000..57048b0 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.Creature.swift @@ -0,0 +1,38 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import UIKit +import CoreStore + + +// MARK: - Advanced.EvolutionDemo.V1.Creature + +@objc(Advanced_EvolutionDemo_V1_Creature) +final class Advanced_EvolutionDemo_V1_Creature: NSManagedObject, Advanced.EvolutionDemo.CreatureType { + + @NSManaged + dynamic var dnaCode: Int64 + + @NSManaged + dynamic var numberOfFlagella: Int32 + + + // MARK: CustomStringConvertible + + override var description: String { + + return """ + dnaCode: \(self.dnaCode) + numberOfFlagella: \(self.numberOfFlagella) + """ + } + + + // MARK: Advanced.EvolutionDemo.CreatureType + + func mutate(in transaction: BaseDataTransaction) { + + self.numberOfFlagella = .random(in: 1...200) + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.swift new file mode 100644 index 0000000..029c77e --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.swift @@ -0,0 +1,25 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import CoreStore + + +// MARK: - Advanced.EvolutionDemo + +extension Advanced.EvolutionDemo { + + // MARK: - Advanced.EvolutionDemo.V1 + + /** + Namespace for V1 models (`Advanced.EvolutionDemo.GeologicalPeriod.ageOfInvertebrates`) + */ + enum V1 { + + // MARK: Internal + + static let name: ModelVersion = "Advanced.Evolution.V1" + + typealias Creature = Advanced_EvolutionDemo_V1_Creature + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..1f5df8e --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Advanced.EvolutionDemo.V1.xcdatamodel + + 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 new file mode 100644 index 0000000..35d3c62 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V1.xcdatamodel/contents @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000..7fdf6aa --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V1.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift new file mode 100644 index 0000000..1e39fd8 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.Creature.swift @@ -0,0 +1,53 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import UIKit +import CoreStore + + +// MARK: - Advanced.EvolutionDemo.V2.Creature + +@objc(Advanced_EvolutionDemo_V2_Creature) +final class Advanced_EvolutionDemo_V2_Creature: NSManagedObject, Advanced.EvolutionDemo.CreatureType { + + @NSManaged + dynamic var dnaCode: Int64 + + @NSManaged + dynamic var numberOfFlippers: Int32 + + @NSManaged + dynamic var hasVertebrae: Bool + + @NSManaged + dynamic var hasHead: Bool + + @NSManaged + dynamic var hasTail: Bool + + + // MARK: CustomStringConvertible + + override var description: String { + + return """ + dnaCode: \(self.dnaCode) + numberOfFlippers: \(self.numberOfFlippers) + hasVertebrae: \(self.hasVertebrae) + hasHead: \(self.hasHead) + hasTail: \(self.hasTail) + """ + } + + + // MARK: Advanced.EvolutionDemo.CreatureType + + func mutate(in transaction: BaseDataTransaction) { + + self.numberOfFlippers = .random(in: 1...4) * 2 + self.hasVertebrae = .random() + self.hasHead = true + self.hasTail = .random() + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.swift new file mode 100644 index 0000000..abd5fae --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.swift @@ -0,0 +1,25 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import CoreStore + + +// MARK: - Advanced.EvolutionDemo + +extension Advanced.EvolutionDemo { + + // MARK: - Advanced.EvolutionDemo.V2 + + /** + Namespace for V2 models (`Advanced.EvolutionDemo.GeologicalPeriod.ageOfFishes`) + */ + enum V2 { + + // MARK: Internal + + static let name: ModelVersion = "Advanced.Evolution.V2" + + typealias Creature = Advanced_EvolutionDemo_V2_Creature + } +} 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 new file mode 100644 index 0000000..4835d3d --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V2.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift new file mode 100644 index 0000000..9446450 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.Creature.swift @@ -0,0 +1,78 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import UIKit +import CoreStore + +// MARK: - Advanced.EvolutionDemo.V3 + +extension Advanced.EvolutionDemo.V3 { + + // MARK: - Advanced.EvolutionDemo.V3.Creature + + final class Creature: CoreStoreObject, Advanced.EvolutionDemo.CreatureType { + + // MARK: Internal + + @Field.Stored("dnaCode") + var dnaCode: Int64 = 0 + + @Field.Stored("numberOfLimbs") + var numberOfLimbs: Int32 = 0 + + @Field.Stored("hasVertebrae") + var hasVertebrae: Bool = false + + @Field.Stored("hasHead") + var hasHead: Bool = true + + @Field.Stored("hasTail") + var hasTail: Bool = true + + @Field.Stored("hasWings") + var hasWings: Bool = false + + @Field.Stored("habitat") + var habitat: Habitat = .water + + + // MARK: - Habitat + + enum Habitat: String, CaseIterable, ImportableAttributeType, FieldStorableType { + + case water = "water" + case land = "land" + case amphibian = "amphibian" + } + + + // MARK: CustomStringConvertible + + var description: String { + + return """ + dnaCode: \(self.dnaCode) + numberOfLimbs: \(self.numberOfLimbs) + hasVertebrae: \(self.hasVertebrae) + hasHead: \(self.hasHead) + hasTail: \(self.hasTail) + habitat: \(self.habitat) + hasWings: \(self.hasWings) + """ + } + + + // MARK: Advanced.EvolutionDemo.CreatureType + + func mutate(in transaction: BaseDataTransaction) { + + self.numberOfLimbs = .random(in: 1...4) * 2 + self.hasVertebrae = .random() + self.hasHead = true + self.hasTail = .random() + self.habitat = Habitat.allCases.randomElement()! + self.hasWings = .random() + } + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.swift new file mode 100644 index 0000000..7437d39 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V3.swift @@ -0,0 +1,23 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import CoreStore + + +// MARK: - Advanced.EvolutionDemo + +extension Advanced.EvolutionDemo { + + // MARK: - Advanced.EvolutionDemo.V3 + + /** + Namespace for V3 models (`Advanced.EvolutionDemo.GeologicalPeriod.ageOfReptiles`) + */ + enum V3 { + + // MARK: Internal + + static let name: ModelVersion = "Advanced.Evolution.V3" + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift new file mode 100644 index 0000000..99bc5ae --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.Creature.swift @@ -0,0 +1,75 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import UIKit +import CoreStore + +// MARK: - Advanced.EvolutionDemo.V4 + +extension Advanced.EvolutionDemo.V4 { + + // MARK: - Advanced.EvolutionDemo.V4.Creature + + final class Creature: CoreStoreObject, Advanced.EvolutionDemo.CreatureType { + + // MARK: Internal + + @Field.Stored("dnaCode") + var dnaCode: Int64 = 0 + + @Field.Stored("numberOfLimbs") + var numberOfLimbs: Int32 = 0 + + @Field.Stored("hasVertebrae") + var hasVertebrae: Bool = false + + @Field.Stored("hasHead") + var hasHead: Bool = true + + @Field.Stored("hasTail") + var hasTail: Bool = false + + @Field.Stored("hasWings") + var hasWings: Bool = false + + + typealias Habitat = Advanced.EvolutionDemo.V3.Creature.Habitat + + @Field.Stored("habitat") + var habitat: Habitat = .water + + @Field.Stored("isWarmBlooded") + var isWarmBlooded: Bool = true + + + // MARK: CustomStringConvertible + + var description: String { + + return """ + dnaCode: \(self.dnaCode) + numberOfLimbs: \(self.numberOfLimbs) + hasVertebrae: \(self.hasVertebrae) + hasHead: \(self.hasHead) + hasTail: \(self.hasTail) + habitat: \(self.habitat) + hasWings: \(self.hasWings) + """ + } + + + // MARK: Advanced.EvolutionDemo.CreatureType + + func mutate(in transaction: BaseDataTransaction) { + + self.numberOfLimbs = .random(in: 1...4) * 2 + self.hasVertebrae = .random() + self.hasHead = true + self.hasTail = .random() + self.habitat = Habitat.allCases.randomElement()! + self.hasWings = .random() + self.isWarmBlooded = .random() + } + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.swift new file mode 100644 index 0000000..6b2738d --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.V4.swift @@ -0,0 +1,23 @@ +// +// Demo +// Copyright © 2020 John Rommel Estropia, Inc. All rights reserved. + +import CoreStore + + +// MARK: - Advanced.EvolutionDemo + +extension Advanced.EvolutionDemo { + + // MARK: - Advanced.EvolutionDemo.V4 + + /** + Namespace for V3 models (`Advanced.EvolutionDemo.GeologicalPeriod.ageOfMammals`) + */ + enum V4 { + + // MARK: Internal + + static let name: ModelVersion = "Advanced.Evolution.V4" + } +} diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift index 8c021de..96315f9 100644 --- a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.swift @@ -11,24 +11,5 @@ extension Advanced { /** Sample execution of progressive migrations. This demo also supports backwards migration. */ - enum EvolutionDemo: CaseIterable { - - // MARK: Internal - - case ageOfInvertebrates - case ageOfFishes - case ageOfReptiles - case ageOfMammals - - var creatureType: Advanced.EvolutionDemo.CreatureType.Type { - - switch self { - - case .ageOfInvertebrates: return Advanced.EvolutionDemo.CreatureV1.self - case .ageOfFishes: return Advanced.EvolutionDemo.CreatureV2.self - case .ageOfReptiles: return Advanced.EvolutionDemo.CreatureV3.self - case .ageOfMammals: return Advanced.EvolutionDemo.CreatureV4.self - } - } - } + enum EvolutionDemo {} } diff --git a/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/.xccurrentversion @@ -0,0 +1,5 @@ + + + + + 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 new file mode 100644 index 0000000..f613fa0 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.V2.xcdatamodel/contents @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000..f613fa0 --- /dev/null +++ b/Demo/⭐️Sources/⭐️Demos/⭐️Advanced/EvolutionDemo/Advanced.EvolutionDemo.xcdatamodeld/Advanced.EvolutionDemo.xcdatamodel/contents @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file