---
title: "compositions(withProtocols:andAttributes:)"
framework: quartz
role: symbol
role_heading: Instance Method
path: "quartz/qccompositionrepository/compositions(withprotocols:andattributes:)"
---

# compositions(withProtocols:andAttributes:)

Returns an array of compositions that match a set of criteria.

## Declaration

```swift
func compositions(withProtocols protocols: [Any]!, andAttributes attributes: [AnyHashable : Any]! = [:]) -> [Any]!
```

## Parameters

- `protocols`: The protocols that you want compositions to conform to. Pass nil if you don’t want to filter based on the protocol. You can pass any of these protocols: QCCompositionProtocolAnimation, QCCompositionProtocolImageProducer, QCCompositionProtocolImageFilter, QCCompositionProtocolImageCompositor, and QCCompositionProtocolScreenSaverRSS.
- `attributes`: A dictionary that contains the attributes, and their associated values, that you want compositions to match. Pass nil if you don’t want to filter based on the attributes. For example, you can pass any of these attributes: QCCompositionAttributeNameKey, QCCompositionAttributeDescriptionKey, QCCompositionAttributeCopyrightKey, and QCCompositionAttributeBuiltInKey.

## Return Value

Return Value An array of QCComposition objects that meet the supplied criteria.

## See Also

### Fetching Compositions

- [composition(withIdentifier:)](quartz/qccompositionrepository/composition(withidentifier:).md)
- [allCompositions()](quartz/qccompositionrepository/allcompositions().md)
