I'm trying the new markdown functionality in SwiftUI but it seems that trying to render markdown from an Attributed String inside a variable strips away any new lines.
This isn't the case when placing the raw markdown directly in the Text View's initialiser, as shown in the preview below.
Is this a bug or is there a way to retain new lines when using Attributed String? None of the options seem to help.
Thanks!
import SwiftUI
struct markdown_test: View {
let attStr = try! AttributedString(markdown: """
Hello **World** 👋🏻 \n\n\n\n
[This is a test](www.google.co.uk)
""")
var body: some View {
VStack(alignment: .leading) {
Text(attStr)
Text("Hello **World** 👋🏻\n[This is a test](www.google.co.uk)")
}
}
}
Post
Replies
Boosts
Views
Activity
I'm trying to use the new Shortcuts for Mac scripting interface on the first Monterey beta.
I'm having trouble running the example AppleScript shown in WWDC21 Meet Shortcuts For Mac (10232):
tell application "Shortcuts Events"
run the shortcut named "Dummy"
end tell
It doesn't seem to recognise a process called 'Shortcuts Events', and I get this error:
The command-line utility works as expected in terminal.