One Logo Pool Ball
Foundation · IOS API REFERENCE

NSPredicate

class · iOS 3.0+ · SDK 27.1

class NSPredicate

Members (9)

init · iOS 3.0+

init

TypeScript
static initFormatArgumentArray(predicateFormat: string, arguments_?: (Array<unknown>) | null): NSPredicate
Swift declaration
init(format predicateFormat: String, argumentArray arguments: [Any]?)
init · iOS 3.0+

init

TypeScript
static initValue(value: boolean): NSPredicate
Swift declaration
init(value: Bool)
method · iOS 7.0+

allowEvaluation

TypeScript
allowEvaluation(): void
Swift declaration
func allowEvaluation()
method · iOS 26.4+

allowEvaluation

TypeScript
allowEvaluationValidator(validator: Implements<NSPredicateValidating> | SDKHandle): void
Swift declaration
func allowEvaluation(validator: any NSPredicateValidating) throws
method · iOS 3.0+

evaluate

TypeScript
evaluateWith(object?: (unknown) | null): boolean
Swift declaration
func evaluate(with object: Any?) -> Bool
method · iOS 3.0+

evaluate

TypeScript
evaluateWithSubstitutionVariables(object?: (unknown) | null, bindings?: (Record<string, unknown>) | null): boolean
Swift declaration
func evaluate(with object: Any?, substitutionVariables bindings: [String : Any]?) -> Bool
method · iOS 3.0+

withSubstitutionVariables

TypeScript
withSubstitutionVariables(variables: Record<string, unknown>): NSPredicate
Swift declaration
func withSubstitutionVariables(_ variables: [String : Any]) -> Self
get · iOS 3.0+

predicateFormat

TypeScript
get predicateFormat(): string
Swift declaration
var predicateFormat: String { get }
init · iOS 17.0+

init

TypeScript
static init(predicate: Predicate<_ObjectiveC_NSObject>): (NSPredicate) | null
Swift declaration
convenience init?<Input>(_ predicate: Predicate<Input>) where Input : NSObject

Creates a predicate by converting an existing predicate. Only a subset of predicates that can be expressed by `Predicate` are convertible to `NSPredicate`. Predicates that include operations like the following can't be converted: - Accessing key paths for properties that aren't exposed to the Objective-C runtime. - Capturing values of types that aren't supported by `NSPredicate`, like custom Swift structures. - Using some functions or operators, like performing collection operations on a nonstring value. - Parameters: - predicate: The predicate to convert. - Returns: The converted predicate, or `nil` if conversion fails.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

NSPredicate.init(format:_:)

A variable number of Swift arguments is not supported.

NSPredicate.init(format:arguments:)

A C variable argument list cannot cross the bridge.

NSPredicate.init(block:)

callback cannot propagate synchronous failure

NSPredicate.init()

inherited init: cannot prove legal (class declares 6 custom initializers)

All Foundation types →