Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update DownView content and keep the style? #19

Closed
ghost opened this issue Feb 9, 2017 · 2 comments
Closed

How to update DownView content and keep the style? #19

ghost opened this issue Feb 9, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 9, 2017

I can add a DownView to my view (use code below) but how can I update the content inside it?

    let cardFrontStr = "Use chained optional to simplify code below,\n\n```\nvar display: UILabel?\nif let label = display {\n  if let text = label.text {\n    let x = text.hasValue\n    // ...\n  }\n}\n```"
    let cardfrontView = try? DownView(frame: cardfront.bounds, markdownString: cardFrontStr)
    cardfront.addSubview(cardfrontView!)

Since the DownView is extended from WebView, I can update the content and loadHTMLString; however, the DownView style is gone after I have done so.

    let down = Down(markdownString: "`test`")
    let newStr = try? down.toHTML()
    cardbackView?.loadHTMLString(newStr!, baseURL: nil)
@iwasrobbed
Copy link
Collaborator

@li-xinyang Thanks for opening an issue. This should be easy enough to add and I will push out a fix for it soon (today or tomorrow)

@iwasrobbed
Copy link
Collaborator

@li-xinyang Closing this via #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant