When it comes to using Markdown on iOS and OS X, there's tons of options. Today we'll look at one popular solution from Simon Fairbairn called SwiftyMarkdown. It helps us translate Swift Strings containing Markdown into NSAttributedStrings. Let's take a look.
let md = SwiftyMarkdown(string: "# SwiftyMarkdown\nConverts *Markdown* files and strings into NSAttributedString") md.attributedString()
It's that simple! SwiftyMarkdown will use some defaults for fonts, colors, etc. Customizing those is quite simple:
md.body.fontName = "AvenirNextCondensed-Medium" md.h1.color = UIColor.redColor() md.h1.fontName = "AvenirNextCondensed-Bold" md.italic.color = UIColor.blueColor()
We can supply custom colors and fonts for each different tag, SwiftyMarkdown even supports inline links, neat!
More info about SwiftyMarkdown can be found at git.io/swiftymarkdown