<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Set/remove(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sh6remove2atxSh5IndexVyx_G_tF"
  },
  "title" : "remove(at:)"
}
-->

# remove(at:)

Removes the element at the given index of the set.

```
@discardableResult mutating func remove(at position: Set<Element>.Index) -> Element
```

## Parameters

`position`

The index of the member to remove. `position` must
be a valid index of the set, and must not be equal to the set’s end
index.

## Return Value

The element that was removed from the set.

---

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)