young
(rtSwift)
1
struct AttributedStringMarkdownList: View {
let s: AttributedString = {
do {
return try AttributedString(
markdown: """
- Lorem ipsum dolor sit amet.
- Ut dolores quaerat non nesciunt nobis ut ullam galisum ea dolorum sint sit repudiandae placeat ut ipsa quia.
- At internos voluptatibus ea repellat assumenda et fuga dicta ea voluptatum repellendus aut libero reiciendis.
"""
)
} catch {
fatalError()
}
}()
var body: some View {
Text(s)
}
}
(BTW, markdown list doesn't seem to work, maybe it's not implemented?)
smkuehnhold
(Samuel Kuehnhold)
2
Any reason you can't simply do let s = try! AttributedString(markdown: "...") if you are just going to fatalError?
3 Likes
young
(rtSwift)
3
No reason. Just didn't think of it.
Thanks!
1 Like