<!--
{
  "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/SetAlgebra/remove(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s10SetAlgebraP6removey7ElementQzSgAEF"
  },
  "title" : "remove(_:)"
}
-->

# remove(_:)

Removes the given element and any elements subsumed by the given element.

```
@discardableResult mutating func remove(_ member: Self.Element) -> Self.Element?
```

## Parameters

`member`

The element of the set to remove.

## Return Value

For ordinary sets, an element equal to `member` if `member` is
contained in the set; otherwise, `nil`. In some cases, a returned
element may be distinguishable from `member` by identity comparison
or some other means.

  For sets where the set type and element type are the same, like
  `OptionSet`   types, this method returns any intersection between the set
  and   `[member]`  , or   `nil`   if the intersection is empty.

---

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)