---
title: generatePassword()
framework: applearchive
role: symbol
role_heading: Instance Method
path: applearchive/archiveencryptioncontext/generatepassword()
---

# generatePassword()

Generates a new password.

## Declaration

```swift
func generatePassword() throws -> String
```

## Return Value

Return Value The new password.

## Discussion

Discussion This function generates a new high entropy password, stores it in the context, and returns it.

## See Also

### Setting a password

- [password](applearchive/archiveencryptioncontext/password.md)
- [setPassword(_:)](applearchive/archiveencryptioncontext/setpassword(_:).md)
