<BlockSwitcher>

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

```swift
func rememberDevice() {
    Amplify.Auth.rememberDevice() { result in
        switch result {
        case .success:
            print("Remember device succeeded")
        case .failure(let error):
            print("Remember device failed with error \(error)")
        }
    }
}
```

</Block>

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

```swift
func rememberDevice() -> AnyCancellable {
    Amplify.Auth.rememberDevice()
        .resultPublisher
        .sink {
            if case let .failure(authError) = $0 {
                print("Remember device failed with error \(authError)")
            }
        }
        receiveValue: {
            print("Remember device succeeded")
        }
}
```

</Block>

</BlockSwitcher>
