NuPlay/RichText
Sobre
Easily show RichText(html) in SwiftUI
Desenvolvimento web e de aplicativosO que você pode fazer
- Cross-platform — iOS 15.0+ and macOS 12.0+, Swift 5.9+
- Automatic sizing — the view resizes itself as the content lays out, including late images, web fonts and <details> toggles
- Theming — automatic light/dark mode, custom color sets, transparent or custom backgrounds
- Typography — system, monospaced, italic, custom and bundled fonts, with Dynamic Type support
Crescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalRichText
Render HTML in SwiftUI.
RichText sizes itself to its content, so HTML fits into a layout like any other view.
Styling, light and dark theming, custom fonts, media callbacks and typed errors are built in.

|
|
|
|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------: |:------------------------------------------------------------------------------------------------------------------------------: |
| Light Mode | Dark Mode |
✨ Features
- Cross-platform — iOS 15.0+ and macOS 12.0+, Swift 5.9+
- Automatic sizing — the view resizes itself as the content lays out, including late images, web fonts and
<details>toggles - Theming — automatic light/dark mode, custom color sets, transparent or custom backgrounds
- Typography — system, monospaced, italic, custom and bundled fonts, with Dynamic Type support
- Interactive media — click callbacks for images and videos
- Link handling — Safari,
SFSafariViewController, or your own handler - HTML5 —
<figure>,<details>,<summary>,<figcaption>and the semantic elements - Error reporting — typed errors for load, configuration and CSS failures
tvOS and watchOS are not supported: Apple does not ship
WKWebViewon those platforms.
🚀 Quick Start
import SwiftUI
import RichText
struct ContentView: View {
let html = """
<h1>Welcome to RichText</h1>
<p>A powerful HTML renderer for SwiftUI.</p>
"""
var body: some View {
ScrollView {
RichText(html: html)
.colorScheme(.auto)
.lineHeight(170)
.imageRadius(12)
.placeholder { ProgressView() }
.onMediaClick { media in
if case .image(let src) = media { print(src) }
}
.onError { error in print(error) }
}
}
}
See the API reference for every modifier, and advanced usage for custom fonts, themes and complete examples.
📦 Installation
Swift Package Manager (Recommended)
- In Xcode, select File → Add Package Dependencies...
- Enter the repository URL:
https://github.com/NuPlay/RichText.git - Select version rule: "Up to Next Major Version" from "3.1.1"
- Click Add Package
Manual Package.swift
Add RichText to your Package.swift:
dependencies: [
.package(url: "https://github.com/NuPlay/RichText.git", .upToNextMajor(from: "3.1.1"))
],
targets: [
.target(
name: "YourTarget",
dependencies: ["RichText"]
)
]
📖 Documentation
| Document | Contents |
|---|---|
| API Reference | Every initializer, modifier and utility |
| Advanced Usage | Custom fonts, theming, media handling, performance, full examples |
| Troubleshooting | Common issues and platform-specific notes |
| Migration Guide | Upgrading from v2.x |
| Changelog | Release notes |
| Contributing | How to report issues and send patches |
🌟 Used By
Open-source apps that render their content with RichText:
| Project | What it is |
|---|---|
| IBM/mac-ibm-notifications | macOS agent for displaying notifications and alerts to managed devices |
| AudioBooth | iOS companion app for Audiobookshelf |
Each of these declares RichText in its public dependency manifest. No affiliation or endorsement is implied in either direction. Using RichText in your project? Open a PR to add it.
📄 License
RichText is available under the MIT license. See the LICENSE file for more info.
🙏 Acknowledgments
- Built with WebKit for reliable HTML rendering
- Inspired by the SwiftUI community's need for rich text solutions
- Thanks to all contributors and users
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with ❤️ for the SwiftUI community
Explore projetos relacionados
Carregando…