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

isEqual(to:)

Returns a Boolean value that indicates whether the receiver is equal to another given object. レシーバが別の与えられたオブジェクトと等しいかどうかを指し示すブール値を返します。

Declaration 宣言

func isEqual(to object: Any?) -> Bool

Parameters パラメータ

object

The object with which to compare the receiver.

Return Value 戻り値

true if the receiver is equal to object, otherwise false. In effect returns false if receiver is nil.

Discussion 解説

During the evaluation of an NSWhoseSpecifier object that contains a test whose operator is NSEqualToComparison, an isEqual(to:) message may be sent to each potentially specified object, if neither the potentially specified object nor the object being tested against implements a scriptingIsEqual(to:) method.

The default implementation for this method provided by NSObject returns true if an isEqualTo: message sent to the same object would return true.

See Also 参照

Performing comparisons 比較を実行する