```swift func resendCode() async { do { let deliveryDetails = try await Amplify.Auth.resendConfirmationCode(forUserAttributeKey: .email) print("Resend code send to - \(deliveryDetails)") } catch let error as AuthError { print("Resend code failed with error \(error)") } catch { print("Unexpected error: \(error)") } } ``` ```swift func resendCode() -> AnyCancellable { Amplify.Publisher.create { try await Amplify.Auth.resendConfirmationCode(forUserAttributeKey: .email) }.sink { if case let .failure(authError) = $0 { print("Resend code failed with error \(authError)") } } receiveValue: { deliveryDetails in print("Resend code sent to - \(deliveryDetails)") } } ```