---
title: "SecTaskValidateForRequirement(task:requirement:)"
framework: lightweightcoderequirements
role: symbol
role_heading: Function
path: "lightweightcoderequirements/sectaskvalidateforrequirement(task:requirement:)"
---

# SecTaskValidateForRequirement(task:requirement:)

Tests whether a task’s executable satisfies a lightweight code requirement.

## Declaration

```swift
func SecTaskValidateForRequirement(task: SecTask, requirement: ProcessCodeRequirement) throws -> Bool
```

## Parameters

- `task`: An object that represents the running task.
- `requirement`: The lightweight code requirement to test.

## Return Value

Return Value If the requirement matches the process, then true; false if it doesn’t.

## Discussion

Discussion This function throws a value from ConstraintError if it can’t evaluate whether the executable satisfies the lightweight code requirement.

## See Also

### Checking code requirements for running processes

- [ProcessCodeRequirement](lightweightcoderequirements/processcoderequirement.md)
- [allOf(requirement:)](lightweightcoderequirements/allof(requirement:)-4k3ay.md)
- [anyOf(requirement:)](lightweightcoderequirements/anyof(requirement:)-vwhn.md)
- [ProcessConstraint](lightweightcoderequirements/processconstraint.md)
- [ProcessCodeSigningFlags](lightweightcoderequirements/processcodesigningflags.md)
- [ProcessConstraintBuilder](lightweightcoderequirements/processconstraintbuilder.md)
- [TeamIdentifierMatchesCurrentProcess](lightweightcoderequirements/teamidentifiermatchescurrentprocess.md)
