<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutBuilder/updateActivity(uuid:adding:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKWorkoutBuilder(im)updateActivityWithUUID:addMedatata:completion:"
  },
  "title" : "updateActivity(uuid:adding:completion:)"
}
-->

# updateActivity(uuid:adding:completion:)

Adds metadata to a workout activity that you’ve already added to the workout builder.

```
func updateActivity(uuid UUID: UUID, adding metadata: [String : Any], completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

```
func updateActivity(uuid UUID: UUID, adding metadata: [String : Any]) async throws
```

## Parameters

`UUID`

The workout activity’s universally unique identifier (UUID).

`metadata`

A dictionary containing the metadata keys and values to add to the workout activity.

`completion`

A callback handler that the system calls after updating the workout activity. The system calls the callback handler on an anonymous background queue.

    The callback handler takes the following parameters:

- success: Contains <doc://com.apple.documentation/documentation/Swift/true> if the builder successfully updates the activity.
- error: If the `success` parameter is <doc://com.apple.documentation/documentation/Swift/false>, this parameter contains information about the error; otherwise, it’s `nil`.

## Discussion

You can call this method multiple times to incrementally add metadata to the workout activity. The system merges the new metadata with any existing metadata using <doc://com.apple.documentation/documentation/Foundation/NSMutableDictionary/addEntries(from:)>. Calling this method after calling [`finishWorkout(completion:)`](/documentation/HealthKit/HKWorkoutBuilder/finishWorkout(completion:)) fails with an error.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)