Surprises When Using Markdown in SwiftUI
Marco Eidinger (via Dave Verwer):
A nice surprise is that SwiftUI supports GitHub Flavored Markdown (GFM). […] An Apple engineer confirmed the use of GFM in the Apple Developer forum.
[…]
Using a string literal in
Textworks. Fine, but using a string variable does not! […] The trick is to use init(_:) ofLocalizedStringKey.[…]
You might run into the situation that you have an
AttributedStringwith line breaks (\n), but those line breaks are not displayed.The trick is to add the
.inlineOnlyPreservingWhitespaceoption when initializing theAttributedString.