CoreData 模型中的 Fetch Index 元素是什么?

What are Fetch Index Elements in the CoreData Model?

在我的 xcdatamodel 中,两个新字段 byTitleIndexcompoundIndex 显示在获取索引元素下。我以前在 Xcode 中没有看到这一部分。什么是获取索引元素?

Fetch Index Elements 是 Apple 在 WWDC 2017 上宣布的新索引 API 的一部分。它们允许您指定一个或多个索引元素;用于创建索引以加快数据库搜索的属性。在您的情况下,"title" 属性 将用于在您的 "Passage" 实体下创建一个名为“compoundIndex”的索引,以便更快地搜索标题。

公告: https://developer.apple.com/videos/play/wwdc2017/210/?time=628

演示: https://developer.apple.com/videos/play/wwdc2017/210/?time=997

文档(向下滚动到 "Working with Indexes"): https://developer.apple.com/documentation/coredata/nsmanagedobjectmodel