NSComparisonMethods

This informal protocol defines a set of default comparison methods useful for the comparisons in NSSpecifierTest.

Overview

If you have scriptable objects that need to perform comparisons for scripting purposes, you may need to implement some of the methods declared in NSScriptingComparisonMethods. The default implementation provided for many of these methods by NSObject is appropriate for objects that implement a single comparison method whose selector, signature, and description match the following:

- (NSComparisonResult)compare:(id)object;

This method should return NSOrderedAscending if the receiver is less than object, NSOrderedDescending if the receiver is greater than object, and NSOrderedSame if the receiver and object are equal. For example, NSString does not implement most of the methods declared in this informal protocol, but NSString objects still handle messages conforming to this protocol properly because NSString implements a compare: method that meets the necessary requirements. Cocoa also includes appropriate compare: method implementations for the NSDate, NSDecimalNumber, and NSValue classes.

Symbols

Performing comparisons

func doesContain(Any)

Returns a Boolean value that indicates whether the receiver contains a given object.

func isCaseInsensitiveLike(String)

Returns a Boolean value that indicates whether receiver is considered to be “like” a given string when the case of characters in the receiver is ignored.

func isEqual(to: Any?)

Returns a Boolean value that indicates whether the receiver is equal to another given object.

func isGreaterThan(Any?)

Returns a Boolean value that indicates whether the receiver is greater than another given object.

func isGreaterThanOrEqual(to: Any?)

Returns a Boolean value that indicates whether the receiver is greater than or equal to another given object.

func isLessThan(Any?)

Returns a Boolean value that indicates whether the receiver is less than another given object.

func isLessThanOrEqual(to: Any?)

Returns a Boolean value that indicates whether the receiver is less than or equal to another given object.

func isLike(String)

Returns a Boolean value that indicates whether the receiver is "like" another given object.

func isNotEqual(to: Any?)

Returns a Boolean value that indicates whether the receiver is not equal to another given object.