Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Xcode does not show index options for CoreData entities and attributes?

In Xcode 9 (beta 6) indexing options are missing in Data Model Inspector (.xcdatamodeld file):

enter image description here enter image description here

They are visible in Xcode 8:

enter image description hereenter image description here

Do you know what reasons are behind this decision?

like image 423
Trzy Gracje Avatar asked Aug 28 '17 15:08

Trzy Gracje


People also ask

What is entity in Coredata Swift?

An entity describes an object, including its name, attributes, and relationships. Create an entity for each of your app's objects.

How do I use Coredata?

Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.

What is entity in Coredata?

An entity description describes an entity (which you can think of as a table in a database) in terms of its name, the name of the class used to represent the entity in your application, and what properties (attributes and relationships) it has.

What is Coredata in iOS?

Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence.


1 Answers

As @tomharrington said, the solution is in the WWDC 2017 video: Indexing stuff begins at 10:32 and the demo at 16:40.

It's still possible to create and index via Xcode9:

  • First, select your entity, long-click on the + (Add Entity), and select Add Fetch Index.

first step

  • Then, name your index appropriately, the select the property you want to index on (and choose ascending or descending, depending on how is organized your data) second step

  • Finally, as explained on the video, this will not trigger a migration and user that update your app will not get your index. If you want to force a model migration, add an Hash Modifier by selecting the entity, and setting Right Panel > 3rd tab > Versioning > Hash Modifier. optionally, third step

like image 128
Martin Avatar answered Sep 27 '22 22:09

Martin