---
title: URL.FormatStyle.Component
framework: foundation
role: symbol
role_heading: Enumeration
path: foundation/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.

## Declaration

```swift
enum Component
```

## Overview

Overview You use this type with style-modifying methods like displayWhen(_:matches:) in URL.FormatStyle.ComponentDisplayOption and omitWhen(_:matches:) in URL.FormatStyle.HostDisplayOption.

## Topics

### URL format style components

- [URL.FormatStyle.Component.scheme](foundation/url/formatstyle/component/scheme.md)
- [URL.FormatStyle.Component.host](foundation/url/formatstyle/component/host.md)
- [URL.FormatStyle.Component.port](foundation/url/formatstyle/component/port.md)
- [URL.FormatStyle.Component.user](foundation/url/formatstyle/component/user.md)
- [URL.FormatStyle.Component.password](foundation/url/formatstyle/component/password.md)
- [URL.FormatStyle.Component.path](foundation/url/formatstyle/component/path.md)
- [URL.FormatStyle.Component.query](foundation/url/formatstyle/component/query.md)
- [URL.FormatStyle.Component.fragment](foundation/url/formatstyle/component/fragment.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Display options

- [always](foundation/url/formatstyle/componentdisplayoption/always.md)
- [never](foundation/url/formatstyle/componentdisplayoption/never.md)
- [omitIfHTTPFamily](foundation/url/formatstyle/componentdisplayoption/omitifhttpfamily.md)
- [displayWhen(_:matches:)](foundation/url/formatstyle/componentdisplayoption/displaywhen(_:matches:).md)
- [omitWhen(_:matches:)](foundation/url/formatstyle/componentdisplayoption/omitwhen(_:matches:).md)
