---
title: "init(pattern:color:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/text/linestyle/init(pattern:color:)"
---

# init(pattern:color:)

Creates a line style.

## Declaration

```swift
init(pattern: Text.LineStyle.Pattern = .solid, color: Color? = nil)
```

## Parameters

- `pattern`: The pattern of the line.
- `color`: The color of the line. If not provided, the foreground color of text is used.

## See Also

### Creating a text line style

- [init(nsUnderlineStyle:)](swiftui/text/linestyle/init(nsunderlinestyle:).md)
- [Text.LineStyle.Pattern](swiftui/text/linestyle/pattern.md)
