Instance Method

result(at:)

Returns the query result at a specific index.

Declaration

func result(at idx: Int) -> Any

Parameters

index

The index of the desired result in the query result array.

Return Value

The query result at the position specified by index. By default, this method returns an NSMetadataItem object representing the requested result; however, the query’s delegate can substitute this object with an instance of a different class.

Discussion

For performance reasons, use this method when retrieving a specific result, rather than the array returned by results.

See Also

Related Symbols

func metadataQuery(NSMetadataQuery, replacementObjectForResultObject: NSMetadataItem)

Implemented by the delegate to return a different object for a specific query result object.

func index(ofResult: Any)

Returns the index of a query result object in the receiver’s results array.