<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutSession/sendToRemoteWorkoutSession(data:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKWorkoutSession(im)sendDataToRemoteWorkoutSession:completion:"
  },
  "title" : "sendToRemoteWorkoutSession(data:completion:)"
}
-->

# sendToRemoteWorkoutSession(data:completion:)

Sends the provided data to the remote workout session.

```
func sendToRemoteWorkoutSession(data: Data, completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

## Parameters

`data`

A data object that contains the data your app is sending to the remote workout session.

`completion`

A block that the system calls when the send attempt is complete. The system passes the following parameters:

- `success`: A Boolean value that indicates whether the system successfully sent the data.
- `error`: If `sucess` is <doc://com.apple.documentation/documentation/Swift/false>, this contains an object that describes the error. Otherwise, it’s `nil`.

## Discussion

Call this method to send data to your remote workout session. You can send data from either the [`HKWorkoutSessionType.mirrored`](/documentation/HealthKit/HKWorkoutSessionType/mirrored) or [`HKWorkoutSessionType.primary`](/documentation/HealthKit/HKWorkoutSessionType/primary) session.

```swift
let archivedData = try? NSKeyedArchiver.archivedData(withRootObject: data, requiringSecureCoding: true)
guard let archivedData = archivedData, !archivedData.isEmpty else {
    // Handle the error here.
    fatalError("*** Encoded data is empty ***")
}

// Send the data to the companion iPhone.
Task {
    do {
        try await session.sendToRemoteWorkoutSession(data: archivedData)
    }
    catch {
        // Handle the error here.
        fatalError("*** An error occurred while sending the health data to the companion iPhone: \(error.localizedDescription) ***")
    }
}
```

---

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)