---
title: "omitWhen(_:matches:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/url/formatstyle/hostdisplayoption/omitwhen(_:matches:)"
---

# omitWhen(_:matches:)

Returns a display option that displays the host component when a specified component matches against a set of requirement values.

## Declaration

```swift
static func omitWhen(_ component: URL.FormatStyle.Component, matches requirements: Set<String>) -> URL.FormatStyle.HostDisplayOption
```

## Parameters

- `component`: A component to compare. This may or may not be the host component itself.
- `requirements`: A set of string values to match against. Matching any member of the set informs the format style to omit the component.

## Return Value

Return Value A display option that omits the host component when a specified component meets the specified requirements.

## See Also

### Display options

- [always](foundation/url/formatstyle/hostdisplayoption/always.md)
- [never](foundation/url/formatstyle/hostdisplayoption/never.md)
- [omitIfHTTPFamily](foundation/url/formatstyle/hostdisplayoption/omitifhttpfamily.md)
- [displayWhen(_:matches:)](foundation/url/formatstyle/hostdisplayoption/displaywhen(_:matches:).md)
- [omitSpecificSubdomains(_:includeMultiLevelSubdomains:)](foundation/url/formatstyle/hostdisplayoption/omitspecificsubdomains(_:includemultilevelsubdomains:).md)
- [omitSpecificSubdomains(_:includeMultiLevelSubdomains:when:matches:)](foundation/url/formatstyle/hostdisplayoption/omitspecificsubdomains(_:includemultilevelsubdomains:when:matches:).md)
- [URL.FormatStyle.Component](foundation/url/formatstyle/component.md)
