JSONMatcher
public final class JSONMatcher : NSObject, Sendable, Codable
A matcher for evaluating a JSON payload against a set of criteria.
JSONMatcher allows you to specify conditions for a JSON value, optionally at a specific key or nested path (scope),
and then evaluate if a given JSON object meets those conditions.
-
Creates a new
JSONMatcher.Declaration
Swift
public convenience init(valueMatcher: JSONValueMatcher)Parameters
valueMatcherThe
JSONValueMatcherto apply to the value.Return Value
A new
JSONMatcherinstance. -
Creates a new
JSONMatcherwith a specified scope.Declaration
Swift
public convenience init(valueMatcher: JSONValueMatcher, scope: [String])Parameters
valueMatcherThe
JSONValueMatcherto apply to the value.scopeAn array of keys representing the path to the value.
Return Value
A new
JSONMatcherinstance. -
Evaluates the given
AirshipJSONvalue against the matcher’s criteria.This method traverses the JSON object using the
scopeandkeyto find the target value, then uses thevalueMatcherto perform the evaluation.Declaration
Swift
public func evaluate(json: AirshipJSON) -> BoolParameters
jsonThe
AirshipJSONobject to evaluate.Return Value
trueif the value matches the criteria; otherwise,false.
View on GitHub