<!--
{
  "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/HostDisplayOption",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation3URLV11FormatStyleV17HostDisplayOptionV"
  },
  "title" : "URL.FormatStyle.HostDisplayOption"
}
-->

# URL.FormatStyle.HostDisplayOption

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

```
struct HostDisplayOption
```

## Topics

### Display options

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

A display option that always displays the host component.

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

A display option that never displays the host component.

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

A display option that omits the host component if the URL scheme is HTTP or HTTPS.

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

Returns a display option that displays the host component when a specified component matches against a set of requirement values.

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

Returns a display option that displays the host component when a specified component matches against a set of requirement values.

[`static func omitSpecificSubdomains(Set<String>, includeMultiLevelSubdomains: Bool) -> URL.FormatStyle.HostDisplayOption`](/documentation/Foundation/URL/FormatStyle/HostDisplayOption/omitSpecificSubdomains(_:includeMultiLevelSubdomains:))

Returns a display option that omits the host component if it matches a set of subdomains.

[`static func omitSpecificSubdomains(Set<String>, includeMultiLevelSubdomains: Bool, when: URL.FormatStyle.Component, matches: Set<String>) -> URL.FormatStyle.HostDisplayOption`](/documentation/Foundation/URL/FormatStyle/HostDisplayOption/omitSpecificSubdomains(_:includeMultiLevelSubdomains:when:matches:))

Returns a display option that omits the host component if it matches a set of subdomains and a specified component matches a set of 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

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

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

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

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

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

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

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

---

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)