---
title: URL.ParseStrategy.ComponentParseStrategy
framework: foundation
role: symbol
role_heading: Enumeration
path: foundation/url/parsestrategy/componentparsestrategy
---

# URL.ParseStrategy.ComponentParseStrategy

The strategy used to parse one component of a URL.

## Declaration

```swift
enum ComponentParseStrategy<Component> where Component : Decodable, Component : Encodable, Component : Hashable, Component : Sendable
```

## Overview

Overview Use this type with the URL.ParseStrategy initializer and static accessors, or its modifier methods, to specify behavior for parsing components of a URL. This allows you to reject URL candidate strings that lack required components — such as a scheme, host, or path — or to fill in default values while parsing.

## Topics

### Component parse strategies

- [URL.ParseStrategy.ComponentParseStrategy.required](foundation/url/parsestrategy/componentparsestrategy/required.md)
- [URL.ParseStrategy.ComponentParseStrategy.optional](foundation/url/parsestrategy/componentparsestrategy/optional.md)
- [URL.ParseStrategy.ComponentParseStrategy.defaultValue(_:)](foundation/url/parsestrategy/componentparsestrategy/defaultvalue(_:).md)

## Relationships

### Conforms To

- [CustomStringConvertible](swift/customstringconvertible.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Creating a URL parse strategy

- [init(scheme:user:password:host:port:path:query:fragment:)](foundation/url/parsestrategy/init(scheme:user:password:host:port:path:query:fragment:).md)
