RLMObject 的 Realm / Get properties/attributes 中的 attributesByName 核心数据方法的等价物

Equivalent of attributesByName core data method in Realm / Get properties/attributes of RLMObject

在核心数据中,如果我有这样的实体

NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:managedObjectContext];

我可以通过

方法获取它的属性
NSDictionary *entityAttributes = [entity attributesByName];

我想知道 Realm 中方法 attributesByName 的等价物是什么。我需要一些可以 return 属性名称和 属性 类型的东西。一直在他们的文档中搜索,但似乎找不到类似的可用功能。

根据文档,我认为您可以从 RLMObject 开始走这条路。

object.objectSchema.properties

这应该会为您提供一个 RLMProperty 类型的对象数组。您在这个 class 的 name 属性 中有名字。通常存储在 kind NSAttributeDescription 的值部分中的大部分信息也可以在此 class 中找到:例如type,等等