Friday, September 15, 2023

Core Data Lab 2.4 Beta

Betamagic:

However, the data model of a SwiftData project is based on Swift class files with a Model macro notation, instead of entities in a Core Data Object Model designer file. As a consequence of this, compiled SwiftData apps don’t have an embedded compiled Core Data Object Model. This makes it impossible for Core Data Lab to search for a matching database by comparing the model of a database with the embedded model of a Core Data app. Core Data Lab uses instead some sparsely documented conventions to determine the location of the database files for a given SwiftData app.

This only affects finding databases that are related to a given app. The databases themselves still contain cached models/schemas, so Core Data Lab can read them without having a compiled model file. My Core Data apps don’t have model files, either, since I’ve been building the models in code.

Model files for previous versions are needed for lightweight migration, as there is no API to directly control the migration. This may have been addressed in Sonoma, although the API is not very clear. You can now create an NSLightweightMigrationStage, but you can’t directly specify a model, only a versionChecksum. If you create an NSManagedObjectModelReference, you can give it a model and checksum, but there is no way to provide the references to the NSStagedMigrationManager. Perhaps simply creating a reference registers it globally to be looked up by checksum?

New in Core Data when used in the latest OS versions, is support for NSCompositeAttributeType attributes. Regarding this, Core Data Lab 2.4 beta adds support for:

  • Displaying composite values in the table, detail and content views as readonly dictionaries.
  • Displaying composite attributes in the Entity Description view of a selected entity.
  • Export and import of composite attributes values via CSV or JSON import and export files.

We want to add editing support for composite attributes in a future update. In the current OS beta’s of Apple it seems that the implementation of composite attributes is not completely ready. Nested composite attributes for example should be supported, but don’t yet work in practice.

I have not tried the Core Data Lab beta yet, but I’ve been enjoying the release version of the app. Version 1.6 added basic support for non–Core Data SQLite files. It’s not as fully featured for this as Base, but the interface is nice. Version 2.3 added viewing improvements such as persistent table column configurations and control over fonts.

Previously:

Update (2023-12-12): I forgot to note that it’s out of beta.

Comments RSS · Twitter · Mastodon

Leave a Comment