<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation3URLV11FormatStyleV22ComponentDisplayOptionV"
  },
  "title" : "URL.FormatStyle.ComponentDisplayOption"
}
-->

# URL.FormatStyle.ComponentDisplayOption

A type that indicates whether a formatted URL should include a component.

```
struct ComponentDisplayOption
```

## Topics

### Display options

[`static var always: URL.FormatStyle.ComponentDisplayOption`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption/always)

A display option that always displays the component.

[`static var never: URL.FormatStyle.ComponentDisplayOption`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption/never)

A display option that never displays the component.

[`static var omitIfHTTPFamily: URL.FormatStyle.ComponentDisplayOption`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption/omitIfHTTPFamily)

A display option that omits the component if the URL scheme is any flavor of HTTP.

[`static func displayWhen(URL.FormatStyle.Component, matches: Set<String>) -> URL.FormatStyle.ComponentDisplayOption`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption/displayWhen(_:matches:))

Returns a display option that displays the component when a specified component meets the specified requirements.

[`static func omitWhen(URL.FormatStyle.Component, matches: Set<String>) -> URL.FormatStyle.ComponentDisplayOption`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption/omitWhen(_:matches:))

Returns a display option that omits the component when a specified component meets the specified requirements.

[`enum Component`](/documentation/Foundation/URL/FormatStyle/Component)

An enumeration of the components of a URL, for use in creating format style options that depend on a component’s value.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Encodable`](/documentation/Swift/Encodable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`Decodable`](/documentation/Swift/Decodable)

---

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)