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

# 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.

```
enum Component
```

## Overview

You use this type with style-modifying methods like [`displayWhen(_:matches:)`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption/displayWhen(_:matches:)) in [`URL.FormatStyle.ComponentDisplayOption`](/documentation/Foundation/URL/FormatStyle/ComponentDisplayOption) and [`omitWhen(_:matches:)`](/documentation/Foundation/URL/FormatStyle/HostDisplayOption/omitWhen(_:matches:)) in [`URL.FormatStyle.HostDisplayOption`](/documentation/Foundation/URL/FormatStyle/HostDisplayOption).

## Topics

### URL format style components

[`case scheme`](/documentation/Foundation/URL/FormatStyle/Component/scheme)

The URL format style scheme component.

[`case host`](/documentation/Foundation/URL/FormatStyle/Component/host)

The URL format style host component.

[`case port`](/documentation/Foundation/URL/FormatStyle/Component/port)

The URL format style port component.

[`case user`](/documentation/Foundation/URL/FormatStyle/Component/user)

The URL format style user component.

[`case password`](/documentation/Foundation/URL/FormatStyle/Component/password)

The URL format style password component.

[`case path`](/documentation/Foundation/URL/FormatStyle/Component/path)

The URL format style path component.

[`case query`](/documentation/Foundation/URL/FormatStyle/Component/query)

The URL format style query component.

[`case fragment`](/documentation/Foundation/URL/FormatStyle/Component/fragment)

The URL format style fragment component.

### Comparing URL format style components

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

---

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)