<BlockSwitcher>

<Block name="Async/Await">

```swift
func updateAttribute() async {
    do {
        let updateResult = try await Amplify.Auth.update(
            userAttribute: AuthUserAttribute(.phoneNumber, value: "+2223334444")
        )

        switch updateResult.nextStep {
        case .confirmAttributeWithCode(let deliveryDetails, let info):
            print("Confirm the attribute with details send to - \(deliveryDetails) \(String(describing: info))")
        case .done:
            print("Update completed")
        }
    } catch let error as AuthError {
        print("Update attribute failed with error \(error)")
    } catch {
        print("Unexpected error: \(error)")
    }
}
```

</Block>

<Block name="Combine">

```swift
func updateAttribute() -> AnyCancellable {
    Amplify.Publisher.create {
        try await Amplify.Auth.update(
          userAttribute: AuthUserAttribute(.phoneNumber, value: "+2223334444")
        )
    }.sink {
        if case let .failure(authError) = $0 {
            print("Update attribute failed with error \(authError)")
        }
    }
    receiveValue: { updateResult in
        switch updateResult.nextStep {
        case .confirmAttributeWithCode(let deliveryDetails, let info):
            print("Confirm the attribute with details send to - \(deliveryDetails) \(info)")
        case .done:
            print("Update completed")
        }
    }
}
```

</Block>

</BlockSwitcher>
