如何在 SwiftUI 中的同一行中使用粗体和普通文本

Eve*_*een 1 swiftui swiftui-text

我想在一个Text视图中使用多种文本格式SwiftUI中使用多种文本格式。这看起来像这样:

\n
\n

我想在同一个文本框中同时拥有多种文本格式,即使它真的真的真的真的 真的文本较长,因此需要正确换行。(甚至可能包括链接!)

\n
\n

我发现了这个(如何在 TextField swiftUI 中加粗文本?) \xc2\xa0\xc2\xa0thread ,但这根​​本不是我想要的。

\n

这将类似于HTML\ 的工作span

\n

Geo*_*e_E 7

在 iOS 15 中,您可以使用 Markdown 来Text

Text("i want to have multiple **formats** for text in the _same **text box**_ at the same time even if it is really _really_ **really _really_** ~~really~~ long text so it would need to wrap correctly. (and maybe even include [links](https://www.apple.com)!)")
Run Code Online (Sandbox Code Playgroud)

结果:

结果