⚠️此项目已弃用 (2023-04-18)⚠️

很遗憾,我们未能找到外部贡献者。 欢迎随意 fork 这个项目。 如果有 fork 流行起来,请在我们的 Discord 上给我们留言,我们可以考虑在本 README 中添加一个指向新项目的链接。

RichTextView

Cocoapods Carthage compatible Builds
All Contributors Discord License - Apache-2 Maturity badge - level 3 Pull Reminders

iOS 文本视图 (UIView),可以正确显示 LaTeX、HTML、Markdown 和 YouTube/Vimeo 链接

安装

使用 Cocoapods

只需将以下内容添加到您的 Podfile

pod 'RichTextView'

并在您的仓库中运行 pod install

使用 Carthage

只需将以下内容添加到您的 Cartfile

github "tophat/RichTextView"

并在您的仓库中运行 carthage update --platform iOS

用法

您可以通过首先导入项目来实例化一个 RichTextView

import RichTextView

初始化 RichTextView

let richTextView = RichTextView(
    input: "Test",
    latexParser: LatexParser(),
    font: UIFont.systemFont(ofSize: UIFont.systemFontSize),
    textColor: UIColor.black,
    isSelectable: true,
    isEditable: false,
    latexTextBaselineOffset: 0,
    interactiveTextColor: UIColor.blue,
    textViewDelegate: nil,
    frame: CGRect.zero,
    completion: nil
)

您也可以按如下方式更新现有的 RichTextView

richTextView.update(
    input: "Test",
    latexParser: LatexParser(),
    font: UIFont.systemFont(ofSize: UIFont.systemFontSize),
    textColor: UIColor.black,
    latexTextBaselineOffset: 0,
    interactiveTextColor: UIColor.blue,
    completion: nil
)

参数定义如下

格式化输入

为了使 RichTextView 能够处理可能遇到的各种用例,输入字符串需要按如下方式格式化

截图

查看 Example 根目录中的示例项目,以查看上面截图的实际效果!

架构

Architecture

贡献

只需克隆仓库,运行 pod install,您就可以开始了

如果您想以可视方式进行 devQA 更改,您可以导航到示例项目(位于根目录 Example 文件夹中),运行 pod install,然后构建并运行该应用程序。 这将向您展示 RichTextView 的一些常用用法。

示例项目指向 RichTextView pod 的本地副本,因此本地进行的任何更改都将反映在示例项目中。

但是,您需要使用旧的构建系统才能看到您的更改反映出来。 关于缓存开发 Pods 和 XCode 10,存在一个已知问题

欢迎随意向示例项目添加更多输入/输出示例,尤其是在您添加任何新功能时。

此外,请务必在本地运行单元/UI 测试,作为 devQA 过程的一部分。

鸣谢

感谢这些优秀的人们(表情符号键


Ahmed Elkady

💻 🤔 ⚠️

Orla Mitchell

💻 🤔 👀

Jake Bolam

🚇📖

Sanchit Gera

📖

Monica Moore

🎨

Brandon Baksh

📖

Siavash Bidgoly

🚇

Stephen Truong

📖

感谢 Carol Skelly 捐赠 Github 组织,以及 Kevin Zhow 捐赠 Pod 名称!