Skip to content

Commit

Permalink
Merge pull request #8623 from funsiyuan/update-README-for-deprecated-…
Browse files Browse the repository at this point in the history
…encryption-example

Update deprecated method usage in encryption example
  • Loading branch information
dacharyc authored Jul 9, 2024
2 parents 9f850cb + b4a09bf commit 235d003
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ Data can be encrypted in-flight and at-rest, keeping even the most sensitive dat
```swift
// Generate a random encryption key
var key = Data(count: 64)
_ = key.withUnsafeMutableBytes { bytes in
SecRandomCopyBytes(kSecRandomDefault, 64, bytes)
_ = key.withUnsafeMutableBytes { (pointer: UnsafeMutableRawBufferPointer) in
guard let baseAddress = pointer.baseAddress else {
fatalError("Failed to obtain base address")
}
SecRandomCopyBytes(kSecRandomDefault, 64, baseAddress)
}

// Add the encryption key to the config and open the realm
Expand Down

0 comments on commit 235d003

Please sign in to comment.