<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSComparisonPredicate/init(leftExpression:rightExpression:modifier:type:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSComparisonPredicate(im)initWithLeftExpression:rightExpression:modifier:type:options:"
  },
  "title" : "init(leftExpression:rightExpression:modifier:type:options:)"
}
-->

# init(leftExpression:rightExpression:modifier:type:options:)

Creates a predicate to a specified type that you form by combining specified left and right expressions using a specified modifier and options.

```
init(leftExpression lhs: NSExpression, rightExpression rhs: NSExpression, modifier: NSComparisonPredicate.Modifier, type: NSComparisonPredicate.Operator, options: NSComparisonPredicate.Options = [])
```

## Parameters

`lhs`

The left hand expression.

`rhs`

The right hand expression.

`modifier`

The modifier to apply.

`type`

The predicate operator type.

`options`

The options to apply (see [`NSComparisonPredicate.Options`](/documentation/Foundation/NSComparisonPredicate/Options-swift.struct)). For no options, pass `0`.

## Return Value

The receiver, initialized to a predicate of type `type` formed by combining the left and right expressions using the `modifier` and `options`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)