<BlockSwitcher>

<Block name="Async/Await">

```swift
let post = Post(title: "Create an Amplify DataStore app",
                status: .active)
do {
    try await Amplify.DataStore.save(post)
    print("Post saved successfully!")
} catch let error as DataStoreError {
    print("Error saving post \(error)")
} catch {
    print("Unexpected error \(error)")
}
```

</Block>

<Block name="Combine">

```swift
let post = Post(title: "Create an Amplify DataStore app",
                status: .active)
let sink = Amplify.Publisher.create {
    try await Amplify.DataStore.save(post)
}.sink {
    if case let .failure(error) = $0 {
        print("Error saving post \(error)")
    }
}
receiveValue: {
    print("Post saved successfully! \($0)")
}
```

</Block>

</BlockSwitcher>
