```swift
do {
try await Amplify.DataStore.save(
Post(title: "My first post",
status: .active,
content: "Amplify.DataStore is awesome!")
)
print("Created a new post successfully")
} catch let error as DataStoreError {
print("Error creating post - \(error)")
} catch {
print("Unexpected error \(error)")
}
```
```swift
let saveSink = Amplify.Publisher.create {
try await Amplify.DataStore.save(
Post(title: "My first post",
status: .active,
content: "Amplify.DataStore is awesome!")
)}.sink {
if case let .failure(error) = $0 {
print("Error updating post - \(error.localizedDescription)")
}
} receiveValue: {
print("Updated the existing post: \($0)")
}
```