MarkdownView is a Swift Package for rendering Markdown text natively in SwiftUI.
Thanks to apple/swift-markdown, it can fully compliant with the CommonMark Spec.
Here is a preview 🙂
You can use MarkdownView in the following platforms:
- macOS 13.0+
- iOS 16.0+
- tvOS 16.0+
Sadly, the system requirements is relatively high because we need to use the Layout Protocal that only supports in the new Operating Systems to automatically position elements.
If you still want to support older operating systems, there is a similar packagegonzalezreal/MarkdownUI.
- Fully compliant with CommonMark
- SVG rendering support
- Highly Customizable and Extensible
- Supports almost all the built-in modifiers
- Fully Native SwiftUI code
You can create a
Markdown view by providing a Markdown-formatted string.
MarkdownView("This is the Apple's **newly published** [swift-markdown](https://github.com/apple/swift-markdown)")
Markdown have CheckBoxes, you can provide a Binding string.
@State var text = "- [x] Buy some eggs"
Swift Package Manager
Package.swift Swift Package Manager manifest, add the following dependency to your
.package(url: "https://github.com/LiYanan2004/MarkdownView.git", .branch("main")),
Add the dependency to any targets you’ve declared in your manifest:
.target(name: "MyTarget", dependencies: ["MarkdownView"]),
- apple/swift-markdown: Parse documents
- SVGKit/SVGKit: Convert SVG to UIImage/NSImage