Instance Method インスタンスメソッド

inverse(forRelationshipKey:)

For a given key that defines the name of the relationship from the receiver’s class to another class, returns the name of the relationship from the other class to the receiver’s class. レシーバのクラスから別のクラスへのリレーションシップ(関係)の名前を定義する指定されたキーに対して、別のクラスからレシーバのクラスへのリレーションシップの名前を返します。

Declaration 宣言

func inverse(forRelationshipKey relationshipKey: String) -> String?

Parameters パラメータ

relationshipKey

The name of the relationship from the receiver’s class to another class. レシーバのクラスから別のクラスへのリレーションシップ(関係)の名前。

Return Value 戻り値

The name of the relationship that is the inverse of the receiver's relationship named relationshipKey.

Discussion 解説

NSObject’s implementation of inverseForRelationshipKey: simply invokes [[self classDescription] inverseForRelationshipKey:relationshipKey]. To make use of the default implementation, you must therefore implement and register a suitable class description—see NSClassDescription.

For example, suppose an Employee class has a relationship named department to a Department class, and that Department has a relationship called employees to Employee. The statement: この平叙文:


employee inverseForRelationshipKey:@"department"];

returns the string employees.

See Also 参照

Working with Class Descriptions クラス記述を扱う