<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PaperKit",
  "identifier" : "/documentation/PaperKit/MarkupOrderedSet/remove(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PaperKit"
    ],
    "preciseIdentifier" : "s:8PaperKit16MarkupOrderedSetV6remove2atAA0C0_pSi_tF"
  },
  "title" : "remove(at:)"
}
-->

# remove(at:)

Removes and returns the element at the specified position.

```
@discardableResult mutating func remove(at index: Int) -> MarkupOrderedSet.Element
```

## Parameters

`index`

The position of the element to remove. `index` must be a valid index of the collection that is not equal to the collection’s end index.

## Return Value

The removed element.

## Discussion

The operation moves all elements following the specified position to close the resulting gap.

---

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)