```swift
Amplify.DataStore.save(
Post(title: "My first post",
description: "Amplify.DataStore is awesome!",
status: .draft)
) {
switch $0 {
case .success:
print("Created a new post successfully")
case .failure(let error):
print("Error creating post - \(error.localizedDescription)")
}
}
```
```swift
let saveSink = Amplify.DataStore.save(
Post(
title: "My first post",
description: "Amplify.DataStore is awesome!",
status: .draft
)
)
.sink {
if case let .failure(error) = $0 {
print("Error creating post - \(error.localizedDescription)")
}
}
receiveValue: {
print("Created a new post successfully: \($0)")
}
```