JSONPredicate
public final class JSONPredicate : NSObject, Sendable, Codable
Defines a predicate for evaluating a JSON payload.
JSONPredicate can be used to build complex logical conditions (AND, OR, NOT)
composed of multiple JSONMatcher objects.
-
Creates a new predicate from a JSON payload.
Throws
An error if the JSON is invalid or cannot be decoded.Declaration
Swift
public convenience init(json: Any?) throwsParameters
jsonThe JSON payload representing the predicate.
-
Evaluates the given
AirshipJSONvalue against the predicate.Declaration
Swift
public func evaluate(json: AirshipJSON) -> BoolParameters
jsonThe
AirshipJSONobject to evaluate.Return Value
trueif the value matches the predicate; otherwise,false. -
Creates a predicate from a
JSONMatcher.Declaration
Swift
public convenience init(jsonMatcher matcher: JSONMatcher)Parameters
matcherThe
JSONMatcherto base the predicate on. -
Creates a predicate by AND-ing an array of sub-predicates.
Declaration
Swift
public class func andPredicate(subpredicates: [JSONPredicate]) -> JSONPredicateParameters
subpredicatesAn array of predicates to combine.
Return Value
A new
JSONPredicateinstance. -
Creates a predicate by OR-ing an array of sub-predicates.
Declaration
Swift
public class func orPredicate(subpredicates: [JSONPredicate]) -> JSONPredicateParameters
subpredicatesAn array of predicates to combine.
Return Value
A new
JSONPredicateinstance. -
Creates a predicate by NOT-ing a single sub-predicate.
Declaration
Swift
public class func notPredicate(subpredicate: JSONPredicate) -> JSONPredicateParameters
subpredicateThe predicate to negate.
Return Value
A new
JSONPredicateinstance.
View on GitHub