---
title: "port(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/url/parsestrategy/port(_:)"
---

# port(_:)

Modifies a parse strategy to parse a URL’s port component in accordance with the provided behavior.

## Declaration

```swift
func port(_ strategy: URL.ParseStrategy.ComponentParseStrategy<Int> = .optional) -> URL.ParseStrategy
```

## Parameters

- `strategy`: A strategy for parsing the port component.

## Return Value

Return Value A modified URL.ParseStrategy that incorporates the specified behavior.

## See Also

### Customizing strategy behavior

- [scheme(_:)](foundation/url/parsestrategy/scheme(_:).md)
- [user(_:)](foundation/url/parsestrategy/user(_:).md)
- [password(_:)](foundation/url/parsestrategy/password(_:).md)
- [host(_:)](foundation/url/parsestrategy/host(_:).md)
- [path(_:)](foundation/url/parsestrategy/path(_:).md)
- [query(_:)](foundation/url/parsestrategy/query(_:).md)
- [fragment(_:)](foundation/url/parsestrategy/fragment(_:).md)
- [URL.ParseStrategy.ComponentParseStrategy](foundation/url/parsestrategy/componentparsestrategy.md)
