<BlockSwitcher>

<Block name="Listener (iOS 11+)">

```swift
let post = Post(title: "Create an Amplify DataStore app",
                status: .active)

Amplify.DataStore.save(post) { result in
    switch result {
    case .success:
        print("Post saved successfully!")
    case .failure(let error):
        print("Error saving post \(error)")
    }
}
```

</Block>

<Block name="Combine (iOS 13+)">

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

</Block>

</BlockSwitcher>
