Home > database >  Opt out of SwiftUI Text Markdown Support in iOS 15
Opt out of SwiftUI Text Markdown Support in iOS 15

Time:09-16

let's say I want to show the following text to the user in Text:

3 4*5, 6*7 8

The new SwiftUI behavior in iOS 15 will render this string in Markdown, making the center part italic.

See here: enter image description here

CodePudding user response:

You can create the Text using the verbatim initializer:

Text(verbatim: “1*2 = 2*1”)

This is supported from iOS 13 and will bypass all conversions and localizations.

https://developer.apple.com/documentation/swiftui/text/init(verbatim:)

  • Related