Nikita Tepliakov
Nikita Tepliakov

Reputation: 69

Value of type 'Text' has no member 'lineHeightMultiple' error message

I want to decrease line height for Text elements in my SwiftUI project. I use the following code and it works fine:

Text("Hello world!\nHello world!")._lineHeightMultiple(0.83)

The problem with the modifier is that it is deprecated and I get the warning: enter image description here

The warning suggests to use lineHeightMultiple instead but when I follow the recommendation I get the error: enter image description here

I tried to use lineHeightMultiple in Xcode 13.2.1 and Xcode 14.1 but I get the same warnings and errors.

I tried to find a documentation regarding this method but it seems the documentation doesn't exist. Xcode just opens a file which doesn't have such method. I tried to install Xcode 12 to find the documentation there but it is not compatible with my MacOS.

I tried to change line height using AttributedString but it doesn't support NSParagraphStyle.

I tried to use lineSpacing modifier but it doesn't support negative values.

I tried to use UILabel or UITextView with UIViewRepresentation but the layout doesn't always work as expected.

I tried to use TextEditor with Introspect library to access UITextView's attributedText parameter but there is a similar issue with layout.

Upvotes: 0

Views: 707

Answers (0)

Related Questions