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

# init(nsUnderlineStyle:)

Creates a Text.LineStyle from NSUnderlineStyle.

## Declaration

```swift
init?(nsUnderlineStyle: NSUnderlineStyle)
```

## Parameters

- `nsUnderlineStyle`: A value of NSUnderlineStyle to wrap with Text.LineStyle.

## Return Value

Return Value A new Text.LineStyle or nil when nsUnderlineStyle contains styles not supported by Text.LineStyle.

## Discussion

Discussion note: Use this initializer only if you need to convert an existing NSUnderlineStyle to a SwiftUI Text.LineStyle. Otherwise, create a Text.LineStyle using an initializer like init(pattern:color:).

## See Also

### Creating a text line style

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