---
title: "init(scheme:user:password:host:port:path:query:fragment:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/url/formatstyle/init(scheme:user:password:host:port:path:query:fragment:)"
---

# init(scheme:user:password:host:port:path:query:fragment:)

Creates a URL format style with the given display options.

## Declaration

```swift
init(scheme: URL.FormatStyle.ComponentDisplayOption = .always, user: URL.FormatStyle.ComponentDisplayOption = .never, password: URL.FormatStyle.ComponentDisplayOption = .never, host: URL.FormatStyle.HostDisplayOption = .always, port: URL.FormatStyle.ComponentDisplayOption = .omitIfHTTPFamily, path: URL.FormatStyle.ComponentDisplayOption = .always, query: URL.FormatStyle.ComponentDisplayOption = .never, fragment: URL.FormatStyle.ComponentDisplayOption = .never)
```

## Parameters

- `scheme`: An option to control display of the URL scheme component.
- `user`: An option to control display of the URL user component.
- `password`: An option to control display of the URL password component.
- `host`: An option to control display of the URL host component.
- `port`: An option to control display of the URL port component.
- `path`: An option to control display of the URL path component.
- `query`: An option to control display of the URL query component.
- `fragment`: An option to control display of the URL fragment component.

## Discussion

Discussion Explicitly create a URL format style in situations where you want to format multiple URLs with the same style configuration. For one-time use, call formatted() for a default style, or create a style with url and customize it with the modifiers in Customizing style behavior.

## See Also

### Creating a URL format style

- [URL.FormatStyle.ComponentDisplayOption](foundation/url/formatstyle/componentdisplayoption.md)
- [URL.FormatStyle.HostDisplayOption](foundation/url/formatstyle/hostdisplayoption.md)
