FreeComponents
Markdown Text
Lightweight Markdown renderer for LLM output — supports headings, fenced code blocks, lists, dividers, and inline formatting (bold, italic, inline code)
Free
Free with a ShipSwift account.
Copies a short instruction with your private download link. Paste it into your agent: it downloads the whole skill (the source code, the setup steps and the mistakes we already made for you) and builds the screen.
Works with
+70
What it does
A self-contained Markdown rendering view designed for common LLM output formats. Parses raw Markdown strings into native SwiftUI views — no WebView or third-party dependencies required. Works on both iOS and macOS.
Supported syntax:
- Headings —
#through####(h1–h4) - Fenced code blocks — triple backticks with optional language label
- Unordered lists —
-,*, or+prefix - Ordered lists —
1.,2., etc. - Horizontal dividers —
---,***, or___ - Inline formatting —
**bold**,*italic*, `inline code
What you get
- ✓286 lines of source code, ready to paste
- ✓Source Code
- ✓Parameters
- ✓Usage
- ✓Integration Checklist
componentdisplaymarkdowntextcode-blockSwiftUI
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
text | String | (required) | Raw Markdown string to render |
codeBackground | Color | .gray.opacity(0.12) | Background color for fenced code blocks |
codeBorderColor | Color | .secondary | Border color for fenced code blocks |
codeCornerRadius | CGFloat | 8 | Corner radius for code blocks |
blockSpacing | CGFloat | 6 | Vertical spacing between blocks |
Usage
// Basic usage — pass any Markdown string
SWMarkdownText("# Hello\n\nThis is **bold** and *italic* text.")
// Display LLM streaming output
SWMarkdownText(viewModel.streamingResponse)
// Code block with language label
SWMarkdownText("```swift\nfunc greet() {\n print(\"Hello, world!\")\n}\n```")
// Custom styling for code blocks
SWMarkdownText(
markdownString,
codeBackground: .black.opacity(0.8),
codeBorderColor: .green,
codeCornerRadius: 12,
blockSpacing: 10
)
// Inside a ScrollView for long content
ScrollView {
SWMarkdownText(longMarkdownString)
.padding()
}Integration Checklist
- Add
SWMarkdownText.swiftto your project (single file, no dependencies) - Verify deployment target is iOS 18+ / macOS 15+ (uses
AttributedStringwithinlineOnlyPreservingWhitespace) - For LLM chat UIs, wrap in
ScrollViewand feed the streaming response string directly - Customize
codeBackgroundandcodeBorderColorto match your app's theme
More in Components
- Add SheetFreeBottom sheet with text input field, Cancel and Continue buttons, presented as a medium detent sheet
- Alert Toast NotificationFreeGlobal toast-style alert overlay with preset styles (info, success, warning, error) and auto-dismiss
- Bullet Point TextFreeText label with a colored capsule bullet point indicator that accepts any View content via @ViewBuilder
- Cached ImageFreeAsyncImage drop-in with a memory + disk cache, so re-created views show remote images on the first frame instead of flashing the placeholder
- Floating LabelsFreeAnimated floating capsule labels that fade in and out at specified positions around an image
- Gradient DividerFreeHorizontal divider with a center-fade gradient effect (clear to color to clear)