<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/ContainsComparator",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents18ContainsComparatorC"
  },
  "title" : "ContainsComparator"
}
-->

# ContainsComparator

An object that determines whether the value of sequence property contains the specified value.

```
final class ContainsComparator<Property, PropertyType, InputType, ComparatorMappingType> where Property : EntityProperty<PropertyType>, PropertyType : _IntentValue, PropertyType : Sendable, InputType : _IntentValue
```

## Topics

### Creating a comparator

[`init(mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(mappingTransform:)-xvws)

Declares support for the `contains` operator between a `AttributedString` property and user-supplied values.

[`init(mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(mappingTransform:)-3xuvt)

Declares support for the `contains` operator between a `String` property and user-supplied values.

[`init(mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(mappingTransform:)-7rx55)

Declares support for the `contains` operator between an optional `Array` property and user-supplied values.

[`init<Spec>(withResolvers: () -> Spec, mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(withResolvers:mappingTransform:)-4482k)

Declares support for the `contains` operator between an `Array` property and user-supplied values.

### Initializers

[`init(mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(mappingTransform:)-7ya5)

Declares support for the `contains` operator between a `AttributedString?` property and user-supplied values.

[`init(mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(mappingTransform:)-9fn0e)

Declares support for the `contains` operator between a `String?` property and user-supplied values.

[`init(mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(mappingTransform:)-coon)

Declares support for the `contains` operator between an `Array` property and user-supplied values.

[`init<Spec>(withResolvers: () -> Spec, mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(withResolvers:mappingTransform:)-3esov)

Declares support for the `contains` operator between a `String` property and user-supplied values.

[`init<Spec>(withResolvers: () -> Spec, mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(withResolvers:mappingTransform:)-5j3ie)

Declares support for the `contains` operator between a `String?` property and user-supplied values.

[`init<Spec>(withResolvers: () -> Spec, mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(withResolvers:mappingTransform:)-7vx0d)

Declares support for the `contains` operator between an optional `Array` property and user-supplied values.

[`init<Spec>(withResolvers: () -> Spec, mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(withResolvers:mappingTransform:)-83nih)

Declares support for the `contains` operator between a `AttributedString` property and user-supplied values.

[`init<Spec>(withResolvers: () -> Spec, mappingTransform: (InputType) -> ComparatorMappingType)`](/documentation/AppIntents/ContainsComparator/init(withResolvers:mappingTransform:)-wpei)

Declares support for the `contains` operator between a `AttributedString?` property and user-supplied values.

## Relationships

### Inherits From

[`EntityQueryComparator`](/documentation/AppIntents/EntityQueryComparator)

---

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)