---
title: "removeAttachment(_:from:completion:)"
framework: healthkit
role: symbol
role_heading: Instance Method
path: "healthkit/hkattachmentstore/removeattachment(_:from:completion:)"
---

# removeAttachment(_:from:completion:)

Removes the specified attachment.

## Declaration

```swift
func removeAttachment(_ attachment: HKAttachment, from object: HKObject, completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

```swift
func removeAttachment(_ attachment: HKAttachment, from object: HKObject) async throws
```

## Parameters

- `attachment`: An attachment associated with the specified object.
- `object`: An object from the HealthKit store.
- `completion`: A completion handler that the system calls after removing the attachment. This handler takes the following parameters:

## Discussion

Discussion Use this method to remove an attachment from an object saved in the HealthKit store. // Remove the attachment from the specified object. do {     try await attachmentStore.removeAttachment(myAttachment, from: myObject) } catch {     // Handle the error here.     fatalError("*** An error occurred while removing an attachment: \(error.localizedDescription) ***") }
