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

# URL.ParseStrategy.ComponentParseStrategy

The strategy used to parse one component of a URL.

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

## Overview

Use this type with the [`URL.ParseStrategy`](/documentation/Foundation/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

[`case required`](/documentation/Foundation/URL/ParseStrategy/ComponentParseStrategy/required)

A strategy that requires the presence of the associated component for parsing to succeed.

[`case optional`](/documentation/Foundation/URL/ParseStrategy/ComponentParseStrategy/optional)

A strategy that treats the presence of the associated component as optional.

[`case defaultValue(Component)`](/documentation/Foundation/URL/ParseStrategy/ComponentParseStrategy/defaultValue(_:))

A strategy that provides a default value for a component if it’s absent in the source string.

## Relationships

### Conforms To

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

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

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

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

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

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

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

---

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)