Class

NSPredicate

A definition of logical conditions for constraining a search for a fetch or for in-memory filtering. フェッチ(主メモリ呼び出し)のためのまたはインメモリフィルタのための検索に制約を加えるための論理条件の定義。

Declaration 宣言

class NSPredicate : NSObject

Overview 概要

Predicates represent logical conditions, which you can use to filter collections of objects. Although it’s common to create predicates directly from instances of NSComparisonPredicate, NSCompoundPredicate, and NSExpression, you often create predicates from a format string that the class methods parse on NSPredicate. Examples of predicate format strings include: 述部は論理条件を表します、それはあなたがオブジェクトのコレクションをフィルタするのに使用できます。普通は述部をNSComparisonPredicateNSCompoundPredicate、そしてNSExpressionのインスタンスから直接に作成するとはいえ、あなたはしばしば述部それらをある書式設定文字列から作成します、それはクラスメソッドがNSPredicate上で構文解析します。述部書式設定文字列の例は以下を含みます:

  • Simple comparisons, such as grade == “7” or firstName like “Juan” 単純な比較、例えばgrade == “7”またはfirstName like “Juan”

  • Case- and diacritic-insensitive lookups, such as name contains[cd] “stein” ケースおよび区別的発音符に配慮しない検索、例えばname contains[cd] “stein”

  • Logical operations, such as (firstName like “Mei”) OR (lastName like “Chen”) 論理演算、例えば(firstName like “Mei”) OR (lastName like “Chen”)

  • Temporal range constraints, such as date between {$YESTERDAY, $TOMORROW} 時を表す範囲の制約、例えばdate between {$YESTERDAY, $TOMORROW}

  • Relational conditions, such as group.name like “work*" 関係条件、例えばgroup.name like “work*"

  • Aggregate operations, such as @sum.items.price < 1000 集合演算、例えば@sum.items.price < 1000

For a complete syntax reference, refer to the Predicate Programming Guide. 完全な構文参照のために、Predicate Programming Guideを参照してください。

You can also create predicates that include variables using the evaluate(with:substitutionVariables:) method so that you can predefine the predicate before substituting concrete values at runtime.

Topics 話題

Creating a Predicate 述部を作成する

Evaluating a Predicate 述部を評価する

Getting a String Representation 文字列表現を取得する

Relationships 関係

Inherits From 継承元

Conforms To 次に準拠

See Also 参照

Filtering フイルタする