You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Second - new to Swift, years of web dev - in my current web app, I can just add a CSS animated cursor as the "last-child:after" to streaming text to get that ChatGPT cursor effect (which is what i'm going for in my current app).
MarkdownUI is working great for translating AI responses into beautiful text BUT once it gets through the first line, every line after that is the "full width" (if that makes sense) - such that any attempt to "attach" an animated cursor effect to the end of the current content is just scrolling down the right hand side of the view.
I've tried a million different attempts, but I think I'm missing something in terms of understanding fully how the text is being rendered in Swift here. This is my basic MarkdownView:
struct MarkdownView: View {
let content: String
let showCursor: Bool
var body: some View {
Markdown(content)
.font(.system(size: 16)) // Set a base font size
.markdownTheme(.gitHub)
.padding()
.background(Color(UIColor.systemBackground))
}
}
Nothing special. In some iterations, with that showCursor conditional I add the animated cursor after the Markdown block above, but still, it just sits on the far right and scrolls down with the content instead of moving along with the text streaming in.
Hopefully this makes sense, and I appreciate any enlightenment/approach that would work best for my use case. Thanks again!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First off, beautiful package - thanks!
Second - new to Swift, years of web dev - in my current web app, I can just add a CSS animated cursor as the "last-child:after" to streaming text to get that ChatGPT cursor effect (which is what i'm going for in my current app).
MarkdownUI is working great for translating AI responses into beautiful text BUT once it gets through the first line, every line after that is the "full width" (if that makes sense) - such that any attempt to "attach" an animated cursor effect to the end of the current content is just scrolling down the right hand side of the view.
I've tried a million different attempts, but I think I'm missing something in terms of understanding fully how the text is being rendered in Swift here. This is my basic MarkdownView:
Nothing special. In some iterations, with that showCursor conditional I add the animated cursor after the Markdown block above, but still, it just sits on the far right and scrolls down with the content instead of moving along with the text streaming in.
Hopefully this makes sense, and I appreciate any enlightenment/approach that would work best for my use case. Thanks again!
Beta Was this translation helpful? Give feedback.
All reactions