---
title: allowEvaluation()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsexpression/allowevaluation()
---

# allowEvaluation()

Forces a securely decoded expression to allow evaluation.

## Declaration

```swift
func allowEvaluation()
```

## Discussion

Discussion When securely decoding an NSExpression object encoded using NSSecureCoding, evaluation is disabled because it is potentially unsafe to evaluate expressions you get out of an archive. Before you enable evaluation, you should validate key paths, selectors, etc to ensure no erroneous or malicious code will be executed. Once you’ve preflighted the expression, you can enable the expression for evaluation by calling allowEvaluation.

## See Also

### Evaluating an Expression

- [expressionValue(with:context:)](foundation/nsexpression/expressionvalue(with:context:).md)
- [false](foundation/nsexpression/false.md)
- [true](foundation/nsexpression/true.md)
