개요

Microsoft는 이번 주 수요일 GitHub를 통해 iOS 플랫폼용 SwiftStreamingMarkdown 렌더링 라이브러리를 오픈 소스로 공개했습니다. 이 라이브러리는 대규모 언어 모델(LLM) 채팅 인터페이스 등에서 마크다운(Markdown) 텍스트를 스트리밍 방식으로 렌더링할 때 발생하는 성능 병목 현상을 해결하기 위해 개발되었습니다.

해당 프로젝트는 MIT 라이선스를 채택하고 있으며, 개발자는 Swift Package Manager를 통해 애플리케이션에 직접 통합할 수 있습니다. 예상되는 추가 다운로드 용량은 약 3MB입니다. 이 라이브러리는 부드러운 스크롤과 글자 단위 애니메이션을 유지하면서도 메인 스레드의 과도한 부하를 방지하도록 설계되었습니다.

기술적 특징

기존의 마크다운 렌더링 방식과 달리, SwiftStreamingMarkdown은 스트리밍 텍스트 생성에 최적화되어 있습니다. AI가 답변을 생성하거나 대화 내용이 실시간으로 나타날 때, 기존 파서들은 문법 트리를 반복적으로 재구성해야 하므로 화면 끊김 현상이 발생하기 쉽습니다. 반면, 이 라이브러리는 텍스트가 도착하는 즉시 분석과 렌더링을 동시에 수행하며 내장된 전환 애니메이션과 부드러운 스크롤을 제공하여 채팅 인터페이스의 상호작용을 원활하게 유지합니다.

개발자는 StreamedMarkdownView 컴포넌트를 사용하여 점진적으로 데이터가 추가되는 비동기 데이터 소스를 연결함으로써 매끄러운 렌더링 경험을 얻을 수 있습니다. 정적 텍스트의 경우 MarkdownView 컴포넌트를 통해 일반적인 렌더링이 가능합니다.

지원 문법 및 기능

SwiftStreamingMarkdown은 CommonMark와 GitHub 스타일 마크다운(GFM)의 핵심 서브셋을 지원하며, 구체적으로 다음과 같은 요소들을 포함합니다:

  • 제목, 단락
  • 굵게, 기울임, 취소선
  • 인라인 코드, 링크
  • 울타리형 코드 블록, 인용 블록
  • 순서 및 무순위 목록
  • 구분선, 표
  • 인라인 및 블록 수준의 LaTeX 수식
  • LLM 출처 추적을 위한 인라인 참조 마크

지원되지 않는 일부 문법(예: 이미지는 대체 텍스트만 표시, 작업 목록 미구현 등)에 대해서는 원본 텍스트를 읽기 가능한 텍스트로 처리하여 콘텐츠 손실이나 렌더링 중단을 방지합니다.

또한 수학 공식 렌더링(LaTeX), 설정 가능한 타이포그래피 및 테마 시스템, iOS 컨텍스트 메뉴 등을 기본으로 지원하며, 분석 및 상호작용 추적을 위한 내장 훅(Hook)을 제공합니다. 개발자는 MarkdownRenderConfig 객체를 통해 전역 스타일을 통합 설정하고, MarkdownListener 프로토콜을 구현하여 렌더링 생명주기 이벤트와 사용자 상호작용을 수신할 수 있습니다.

성능 및 통합

Microsoft에 따르면 iPhone XS에서 진행한 성능 테스트 결과, 높은 부하의 스트리밍 콘텐츠가 지속적으로 전송되는 상황에서도 메인 스레드의 작업 부하가 다른 일반적인 라이브러리보다 효과적으로 제어되었으며 눈에 띄는 UI 끊김이 발생하지 않았습니다.

개발자는 Xcode에서 "File — Add Package Dependencies"를 통해 GitHub 저장소 주소를 입력하고 버전을 선택하여 통합하거나, Package.swift 파일에 의존성 항목을 추가할 수 있습니다. 또한 공식 GitHub 페이지에서는 SwiftUI 샘플 프로젝트를 제공하며, 이를 통해 스트리밍 데모, 설정 인터페이스 및 로그 리스너 구현 사례를 확인할 수 있습니다.

총평

项目概述

微软在 GitHub 上开源了面向 iOS 平台的 SwiftStreamingMarkdown 渲染库。该库专门针对大语言模型(LLM)聊天界面中的流式文本渲染进行了优化,旨在解决传统解析器在处理动态生成内容时导致的性能瓶颈。

  • 许可证:MIT
  • 集成方式:Swift Package Manager
  • 预计增加体积:约 3 MB

核心技术优势

与需要反复重组语法树的传统方案不同,SwiftStreamingMarkdown 支持随文本到达同步进行解析与渲染。该库提供内置的过渡动画和平滑滚动功能,确保在 AI 生成内容时界面交互流畅。

  • StreamedMarkdownView:用于绑定异步数据源,实现流式内容的逐段渲染。
  • MarkdownView:用于常规静态文本的渲染。

语法支持与功能特性

该库定位为 CommonMark 与 GitHub 风格 Markdown(GFM)的核心子集。对于不支持的扩展语法(如图片、任务列表等),系统会自动降级显示为可读文本。

  • 基础语法:标题、段落、粗体与斜体、删除线、行内代码、链接、围栏式代码块、引用块、有序与无序列表、分隔线、表格。
  • 高级功能:支持 LaTeX 行内与块级公式渲染、可配置的排版与主题系统、iOS 上下文菜单、用于分析与交互追踪的内置钩子。
  • 特殊支持:包含面向 LLM 来源溯源的内联引用标记。

性能表现与集成

微软在 iPhone XS 上进行的测试表明,该库在持续流式内容推送的高负载场景下,主线程工作负载控制优于其他常见库,且无明显 UI 卡顿。

  • 支持通过 Swift Package Manager 在 Xcode 中快速添加依赖。
  • 官方仓库提供完整的 SwiftUI 示例工程,涵盖了流式演示、设置界面及日志监听等功能。

总结

微软推出的 SwiftStreamingMarkdown 是一个专门为 iOS 端 LLM 对话场景优化的 Markdown 渲染库。它通过流式解析技术解决了大模型生成内容时的卡顿问题,并提供了丰富的 LaTeX 支持和优秀的性能表现。

概要

Microsoftは今週水曜日、GitHubを通じてiOSプラットフォーム向けのSwiftStreamingMarkdownレンダリングライブラリをオープンソースとして公開しました。このライブラリは、大規模言語モデル(LLM)のチャットインターフェースなどで、Markdownテキストをストリーミング形式でレンダリングする際に発生するパフォーマンスのボトルネックを解消するために開発されました。

本プロジェクトはMITライセンスを採用しており、開発者はSwift Package Managerを通じてアプリケーションに直接統合できます。追加のダウンロード容量は約3MBです。このライブラリは、スムーズなスクロールと文字単位のアニメーションを維持しながら、メインスレッドへの過度な負荷を防ぐように設計されています。

技術的特徴

従来のMarkdownレンダリング方式とは異なり、SwiftStreamingMarkdownはストリーミングテキストの生成に最適化されています。AIが回答を生成したり、会話内容がリアルタイムで表示される際、従来のパーサーは構文ツリーを繰り返し再構築する必要があるため、画面の途切れが発生しやすくなります。一方、このライブラリはテキストが届いた瞬間に解析とレンダリングを同時に実行し、内蔵された遷移アニメーションとスムーズなスクロールを提供することで、チャットインターフェースのインタラクションを円滑に保ちます。

開発者はStreamedMarkdownViewコンポーネントを使用して、動的にデータが追加される非同期データソースを接続することで、滑らかなレンダリング体験を得ることができます。静的なテキストの場合は、MarkdownViewコンポーネントを通じて通常のレンダリングが可能です。

サポート構文および機能

SwiftStreamingMarkdownはCommonMarkおよびGitHubスタイルMarkdown(GFM)の主要なサブセットをサポートしており、具体的には以下の要素が含まれます:

  • 見出し、段落
  • 太字、斜体、打ち消し線
  • インラインコード、リンク
  • フェンス付きコードブロック、引用ブロック
  • 順序付きおよび順不同のリスト
  • 区切り線、表
  • インラインおよびブロックレベルのLaTeX数式
  • LLMのソース追跡のためのインライン参照マーク

サポートされていない一部の構文(例:画像は代替テキストのみ表示、タスクリスト未実装など)については、元のテキストを読み取り可能なテキストとして処理することで、コンテンツの損失やレンダリングの中断を防ぎます。

また、数学公式のレンダリング(LaTeX)、設定可能なタイポグラフィーおよびテーマシステム、iOSコンテキストメニューなどを標準でサポートしており、解析およびインタラクション追跡のための内蔵フック(Hook)も提供されます。開発者はMarkdownRenderConfigオブジェクトを通じてグローバルスタイルを一括設定し、MarkdownListenerプロトコルを実装することで、レンダリングライフサイクルイベントやユーザーのインタラクションを受信できます。

性能および統合

Microsoftによると、iPhone XSで実施されたパフォーマンステストの結果、高負荷なストリーミングコンテンツが継続的に送信される状況でも、メインスレッドの負荷が他の一般的なライブラリよりも効果的に制御され、目立ったUIの途切れが発生しないことが確認されました。

開発者はXcodeで「File — Add Package Dependencies」からGitHubリポジトリのアドレスを入力してバージョンを選択することで統合するか、Package.swiftファイルに依存関係を追加することができます。また、公式GitHubページではSwiftUIのサンプルプロジェクトが提供されており、ストリーミングデモ、設定インターフェース、ログリスナーの実装例を確認できます。

まとめ

MicrosoftはLLMチャットなどのストリーミングテキスト表示に最適化されたiOS向けMarkdownレンダリングライブラリ「SwiftStreamingMarkdown」を公開しました。このライブラリは、リアルタイムなコンテンツ更新時でもメインスレッドの負荷を抑えつつ、スムーズなスクロールやアニメーションを実現します。CommonMarkやGFMの主要機能を網羅しており、LaTeX数式やカスタマイズ可能なテーマなど、高度な機能も備えています。

Overview

Microsoft released the SwiftStreamingMarkdown rendering library for the iOS platform on GitHub this Wednesday. This library was developed to resolve performance bottlenecks that occur when rendering Markdown text in a streaming manner, particularly in Large Language Model (LLM) chat interfaces.

The project is released under the MIT license and can be integrated directly into applications via Swift Package Manager. The estimated additional download size is approximately 3MB. The library is designed to maintain smooth scrolling and character-level animations while preventing excessive load on the main thread.

Technical Features

Unlike traditional Markdown rendering methods, SwiftStreamingMarkdown is optimized for streaming text generation. When AI generates responses or content appears in real-time, standard parsers often cause screen stuttering because they must repeatedly reconstruct the syntax tree. In contrast, this library performs analysis and rendering simultaneously as text arrives, providing built-in transition animations and smooth scrolling to maintain a fluid interaction within chat interfaces.

Developers can achieve a seamless rendering experience by using the StreamedMarkdownView component to connect asynchronous data sources where data is added incrementally. For static text, the MarkdownView component can be used for standard rendering.

Supported Syntax and Features

SwiftStreamingMarkdown supports core subsets of CommonMark and GitHub Flavored Markdown (GFM), specifically including the following elements:

  • Headers and paragraphs
  • Bold, italics, and strikethrough
  • Inline code and links
  • Fenced code blocks and blockquotes
  • Ordered and unordered lists
  • Horizontal rules and tables
  • Inline and block-level LaTeX formulas
  • Inline reference marks for LLM source tracking

For certain unsupported syntaxes (e.g., images only display alt text, task lists are not implemented), the library processes the original text as readable plain text to prevent content loss or rendering interruptions.

Additionally, it provides native support for mathematical formula rendering (LaTeX), configurable typography and theme systems, and iOS context menus. It also includes built-in hooks for analytics and interaction tracking. Developers can configure global styles through the MarkdownRenderConfig object and implement the MarkdownListener protocol to receive rendering lifecycle events and user interactions.

Performance and Integration

According to Microsoft, performance tests conducted on an iPhone XS showed that even when high-load streaming content was continuously transmitted, the main thread workload was managed more effectively than with other common libraries, resulting in no noticeable UI stuttering.

Developers can integrate the library by entering the GitHub repository address and selecting a version via "File — Add Package Dependencies" in Xcode, or by adding the dependency entry to the Package.swift file. Furthermore, the official GitHub page provides a SwiftUI sample project where developers can review examples of streaming demos, configuration interfaces, and log listener implementations.

Summary

Microsoft has released SwiftStreamingMarkdown, an iOS library designed to provide smooth, real-time Markdown rendering for applications like LLM chat interfaces. By processing text as it arrives rather than rebuilding the syntax tree repeatedly, it ensures high performance and fluid animations on mobile devices. The library supports a wide range of features including GFM, LaTeX math, and customizable themes, with easy integration via Swift Package Manager.

项目概述

Microsoft 在 GitHub 上开源了面向 iOS 平台的 SwiftStreamingMarkdown 渲染库。该工具旨在解决大语言模型(LLM)聊天界面中流式渲染 Markdown 文本时的性能瓶颈,确保在内容逐字生成时,应用能够保持流畅的滚动效果和平滑的动画。

核心功能与技术特性

SwiftStreamingMarkdown 针对流式文本进行了深度优化。不同于传统解析器因频繁重构语法树而导致界面卡顿,该库支持在文本到达的同时完成解析与渲染。其提供的核心组件包括:

  • StreamedMarkdownView:用于绑定异步数据源,实现平滑的逐段流式渲染。
  • MarkdownView:用于常规静态文本的渲染。

该库采用 MIT 许可证,支持通过 Swift Package Manager 集成,预计增加约 3 MB 的下载体积。此外,它还提供可配置的排版与主题系统、iOS 上下文菜单,以及用于分析与交互追踪的内置钩子(如 MarkdownRenderConfig 和 MarkdownListener 协议)。

语法支持与性能表现

该库支持 CommonMark 与 GitHub 风格 Markdown(GFM)的核心子集。具体涵盖的内容包括:

  • 基础格式:标题、段落、粗体、斜体、删除线。
  • 代码与链接:行内代码、围栏式代码块、链接、引用块。
  • 高级内容:分隔线、表格、行内及块级 LaTeX 公式,以及面向 LLM 来源溯源的内联引用标记。

对于不支持的语法(如图片、任务列表等),该库将自动降级为可读文本以保证渲染不中断。在 iPhone XS 的性能测试中,该库在高负载流式内容推送场景下的主线程工作负载优于其他常见库,未出现明显的 UI 卡顿。

总结

Microsoft 推出的 SwiftStreamingMarkdown 是一个专门针对 iOS 平台设计的 Markdown 渲染库,旨在优化大模型(LLM)对话场景中的流式文本展示。通过高性能的解析逻辑和丰富的语法支持,该工具能确保在动态内容生成时提供流畅的交互体验。

概要

Microsoftは今週水曜日、GitHubを通じてiOSプラットフォーム向けのSwiftStreamingMarkdownレンダリングライブラリをオープンソースとして公開しました。このライブラリは、大規模言語モデル(LLM)のチャットインターフェースなどで、Markdownテキストをストリーミング形式でレンダリングする際に発生するパフォーマンスのボトルネックを解決するために開発されました。

本プロジェクトはMITライセンスを採用しており、開発者はSwift Package Managerを通じてアプリケーションに直接統合することが可能です。追加のダウンロード容量は約3MBです。このライブラリは、スムーズなスクロールと文字単位のアニメーションを維持しながら、メインスレッドへの過度な負荷を防ぐように設計されています。

技術的特徴

従来のMarkdownレンダリング方式とは異なり、SwiftStreamingMarkdownはストリーミングテキストの生成に最適化されています。AIが回答を生成したり、会話内容がリアルタイムで表示される際、従来のパーサーは構文ツリーを繰り返し再構築する必要があるため、画面の途切れが発生しやすくなります。一方、このライブラリはテキストが到着した瞬間に解析とレンダリングを同時に実行し、内蔵された遷移アニメーションとスムーズなスクロールを提供することで、チャットインターフェースのインタラクションを円滑に保ちます。

開発者はStreamedMarkdownViewコンポーネントを使用することで、データが漸進的に追加される非同期データソースを接続し、滑らかなレンダリング体験を得ることができます。静的なテキストについては、MarkdownViewコンポーネントを通じて通常のレンダリングを行うことが可能です。

サポート構文および機能

SwiftStreamingMarkdownは、CommonMarkおよびGitHubスタイルMarkdown(GFM)の主要なサブセットをサポートしており、具体的には以下の要素が含まれます:

  • 見出し、段落
  • 太字、斜体、打ち消し線
  • インラインコード、リンク
  • フェンス付きコードブロック、引用ブロック
  • 順序付きおよび順序なしリスト
  • 区切り線、表
  • インラインおよびブロックレベルのLaTeX数式
  • LLMのソース追跡のためのインライン参照マーク

サポートされていない一部の構文(例:画像は代替テキストのみ表示、タスクリスト未実装など)については、元のテキストを読み取り可能なテキストとして処理することで、コンテンツの損失やレンダリングの中断を防ぎます。

さらに、数学公式のレンダリング(LaTeX)、カスタマイズ可能なタイポグラフィおよびテーマシステム、iOSコンテキストメニューなどを標準でサポートしており、分析およびインタラクション追跡のための内蔵フック(Hook)を提供します。開発者はMarkdownRenderConfigオブジェクトを通じてグローバルスタイルを一括設定し、MarkdownListenerプロトコルを実装することで、レンダリングのライフサイクルイベントやユーザーのインタラクションを受信できます。

性能と統合

Microsoftによると、iPhone XSで実施されたパフォーマンステストの結果、負荷の高いストリーミングコンテンツが継続的に送信される状況においても、メインスレッドの負荷が他の一般的なライブラリよりも効果的に制御され、目立ったUIの途切れが発生しないことが確認されました。

開発者はXcodeで「File — Add Package Dependencies」からGitHubリポジトリのアドレスを入力してバージョンを選択することで統合するか、Package.swiftファイルに依存関係を追加することができます。また、公式GitHubページではSwiftUIのサンプルプロジェクトが提供されており、ストリーミングデモ、設定インターフェース、およびログリスナーの実装例を確認することができます。

まとめ

Microsoftは、LLMのチャットインターフェースに最適化されたiOS向けMarkdownレンダリングライブラリ「SwiftStreamingMarkdown」を公開しました。このライブラリはストリーミングデータの解析とレンダリングを同時に行うことで、メインスレッドへの負荷を抑えつつスムーズなUI体験を実現します。また、LaTeXや豊富なカスタマイズオプションを備えており、高度なチャットUIの開発を支援します。

Overview

Microsoft has released an open-source rendering library for the iOS platform called SwiftStreamingMarkdown via GitHub. This library was specifically developed to resolve performance bottlenecks that occur when rendering Markdown text in a streaming fashion, particularly within Large Language Model (LLM) chat interfaces.

The project is released under the MIT license and can be integrated into applications directly through the Swift Package Manager, with an estimated additional download size of approximately 3MB. The library is designed to maintain smooth scrolling and character-level animations while preventing excessive load on the main thread.

Technical Features

Unlike traditional Markdown rendering methods, SwiftStreamingMarkdown is optimized for streaming text generation. When AI generates responses or conversation content appears in real-time, conventional parsers often cause screen stuttering because they must repeatedly reconstruct the syntax tree. In contrast, this library performs parsing and rendering simultaneously as text arrives, providing built-in transition animations and smooth scrolling to maintain a fluid experience in chat interfaces.

Developers can utilize the StreamedMarkdownView component to connect asynchronous data sources where data is added incrementally for a seamless rendering experience. For static text, the MarkdownView component can be used for standard rendering.

Supported Syntax and Features

SwiftStreamingMarkdown supports core subsets of CommonMark and GitHub Flavored Markdown (GFM), specifically including the following elements:

  • Headers and paragraphs
  • Bold, italic, and strikethrough
  • Inline code and links
  • Fenced code blocks and blockquotes
  • Ordered and unordered lists
  • Horizontal rules and tables
  • Inline and block-level LaTeX formulas
  • Inline reference marks for LLM source tracking

For certain unsupported syntaxes (e.g., images, which display only alt text, or unimplemented task lists), the library processes the original text as readable plain text to prevent content loss or rendering interruptions.

Additionally, it provides native support for mathematical formula rendering (LaTeX), customizable typography and theme systems, and iOS context menus. It also includes built-in hooks for analytics and interaction tracking. Developers can configure global styles through the MarkdownRenderConfig object and implement the MarkdownListener protocol to receive rendering lifecycle events and user interaction data.

Performance and Integration

According to Microsoft, performance tests conducted on the iPhone XS showed that even when high-load streaming content was continuously delivered, the main thread load was managed more effectively than with other common libraries, resulting in no noticeable UI stuttering.

Developers can integrate the library by entering the GitHub repository address and selecting a version via "File — Add Package Dependencies" in Xcode, or by adding the dependency to the Package.swift file. Furthermore, the official GitHub page provides SwiftUI sample projects, which include examples of streaming demos, configuration interfaces, and log listener implementations.

Summary

Microsoft has released SwiftStreamingMarkdown, an open-source iOS library designed to provide smooth, high-performance rendering for streaming Markdown content in LLM applications. By processing text as it arrives rather than re-parsing the entire tree, it eliminates UI stuttering and maintains fluid animations on the main thread. The library supports a wide range of features including GFM syntax, LaTeX formulas, and customizable themes.

项目概述

Microsoft 在 GitHub 上开源了面向 iOS 平台的 SwiftStreamingMarkdown 渲染库。该库专门针对大语言模型(LLM)聊天界面等场景中的流式 Markdown 文本渲染进行了优化,旨在解决传统解析器在处理逐字生成内容时导致的性能瓶颈和主线程负载问题。

核心功能与技术特性

SwiftStreamingMarkdown 提供两种主要的组件以适应不同需求:

  • StreamedMarkdownView:用于绑定异步数据源,实现随着文本到达同步进行的平滑逐段渲染。
  • MarkdownView:用于常规的静态 Markdown 文本渲染。

在语法支持方面,该库涵盖了 CommonMark 与 GitHub 风格 Markdown(GFM)的核心子集:

  • 基础样式:标题、段落、粗体、斜体、删除线、行内代码。
  • 结构化内容:链接、围栏式代码块、引用块、有序与无序列表、分隔线、表格。
  • 高级渲染:支持行内及块级 LaTeX 公式,以及面向 LLM 溯源的内联引用标记。

对于不支持的扩展语法(如图片、任务列表等),该库会将原始文本降级显示为可读文本以确保内容不丢失。

性能表现与集成信息

该项目在技术规格和易用性上具备以下特点:

  • 授权与体积:采用 MIT 许可证,支持通过 Swift Package Manager 集成,预计增加约 3 MB 的下载量。
  • 性能测试:在 iPhone XS 上进行的压力测试显示,在高负载流式内容滚动场景下,其主线程工作负载控制优于其他常见库,无明显 UI 卡顿。
  • 扩展功能:支持可配置的排版与主题系统、iOS 上下文菜单,并提供用于分析与交互追踪的内置钩子(通过 MarkdownRenderConfig 和 MarkdownListener 实现)。

总结

Microsoft 推出的 SwiftStreamingMarkdown 是一个专门为 iOS 平台优化的流式渲染库,旨在解决 LLM 对话场景中的性能瓶颈。它在保证流畅滚动和低主线程负载的同时,提供了丰富的语法支持及高度可配置的样式系统。

概要

Microsoftは今週水曜日、GitHubを通じてiOSプラットフォーム向けの「SwiftStreamingMarkdown」レンダリングライブラリをオープンソースとして公開しました。このライブラリは、大規模言語モデル(LLM)のチャットインターフェースなどで、Markdownテキストをストリーミング形式でレンダリングする際に発生するパフォーマンスのボトルネックを解消するために開発されました。

本プロジェクトはMITライセンスを採用しており、開発者はSwift Package Managerを通じてアプリケーションに直接統合することが可能です。追加のダウンロード容量は約3MBです。このライブラリは、スムーズなスクロールと文字単位のアニメーションを維持しながら、メインスレッドへの過度な負荷を防ぐように設計されています。

技術的特徴

従来のMarkdownレンダリング方式とは異なり、SwiftStreamingMarkdownはストリーミングテキストの生成に最適化されています。AIが回答を生成したり、会話内容がリアルタイムで表示される際、従来のパーサーは構文ツリーを繰り返し再構築する必要があるため、画面の途切れが発生しやすくなります。一方、このライブラリはテキストが届いた瞬間に解析とレンダリングを同時に実行し、内蔵された遷移アニメーションとスムーズなスクロールを提供することで、チャットインターフェースの操作性を円滑に保ちます。

開発者は「StreamedMarkdownView」コンポーネントを使用して、動的にデータが追加される非同期データソースを接続することで、滑らかなレンダリング体験を実現できます。静的なテキストについては、「MarkdownView」コンポーネントを通じて通常のレンダリングを行うことが可能です。

サポート構文および機能

SwiftStreamingMarkdownはCommonMarkおよびGitHubスタイルMarkdown(GFM)の主要なサブセットをサポートしており、具体的には以下の要素が含まれます:

  • 見出し、段落
  • 太字、斜体、打ち消し線
  • インラインコード、リンク
  • フェンス付きコードブロック、引用ブロック
  • 順序付きおよび順不同のリスト
  • 区切り線、表
  • インラインおよびブロックレベルのLaTeX数式
  • LLMのソース追跡のためのインライン参照マーク

サポートされていない一部の構文(例:画像は代替テキストのみ表示、タスクリスト未実装など)については、元のテキストを読み取り可能なテキストとして処理することで、コンテンツの損失やレンダリングの中断を防ぎます。

また、数学公式のレンダリング(LaTeX)、カスタマイズ可能なタイポグラフィーおよびテーマシステム、iOSコンテキストメニューなどを標準でサポートしており、解析およびインタラクション追跡のための内蔵フック(Hook)も提供されます。開発者はMarkdownRenderConfigオブジェクトを通じてグローバルスタイルを一括設定し、MarkdownListenerプロトコルを実装することで、レンダリングライフサイクルイベントやユーザーのインタラクションを受信できます。

性能および統合

MicrosoftによるiPhone XSでのパフォーマンステストの結果、高負荷なストリーミングコンテンツが継続的に送信される状況でも、メインスレッドの負荷が他の一般的なライブラリよりも効果的に制御され、目立ったUIの途切れが発生しないことが確認されました。

開発者はXcodeで「File — Add Package Dependencies」からGitHubリポジトリのアドレスを入力して統合するか、Package.swiftファイルに依存関係を追加することで導入できます。また、公式GitHubページではSwiftUIのサンプルプロジェクトが提供されており、ストリーミングデモ、設定インターフェース、ログリスナーの実装例を確認することが可能です。

まとめ

Microsoftが公開した「SwiftStreamingMarkdown」は、LLMチャットなどのストリーミングテキスト表示に特化したiOS向けレンダリングライブラリです。リアルタイムなコンテンツ更新時でもメインスレッドの負荷を抑えつつ、スムーズなスクロールやLaTeX数式の描画を実現する機能を備えています。高度なカスタマイズ性と優れたパフォーマンスにより、AIアプリケーションの開発を強力にサポートします。

Overview

Microsoft released the SwiftStreamingMarkdown rendering library for the iOS platform on GitHub this Wednesday. This library was specifically developed to address performance bottlenecks that occur when rendering Markdown text in a streaming manner, particularly within Large Language Model (LLM) chat interfaces.

The project is licensed under MIT and can be integrated directly into applications via Swift Package Manager. The estimated additional download size is approximately 3MB. The library is designed to maintain smooth scrolling and character-level animations while preventing excessive load on the main thread.

Technical Features

Unlike traditional Markdown rendering methods, SwiftStreamingMarkdown is optimized for streaming text generation. When AI generates responses or content appears in real-time, conventional parsers often cause UI stuttering because they must repeatedly reconstruct the syntax tree. In contrast, this library performs parsing and rendering simultaneously as text arrives, providing built-in transition animations and smooth scrolling to ensure a fluid interaction experience.

Developers can use the StreamedMarkdownView component to connect asynchronous data sources for progressively added content, while the MarkdownView component is available for standard static text rendering.

Supported Syntax and Features

SwiftStreamingMarkdown supports a core subset of CommonMark and GitHub Flavored Markdown (GFM), specifically including the following elements:

  • Headers and paragraphs
  • Bold, italic, and strikethrough
  • Inline code and links
  • Fenced code blocks and blockquotes
  • Ordered and unordered lists
  • Horizontal rules and tables
  • Inline and block-level LaTeX equations
  • Inline reference marks for LLM source tracking

For certain unsupported syntaxes (e.g., images are displayed as alt-text only, task lists are not implemented), the library processes the original text as readable plain text to prevent content loss or rendering interruptions.

Additionally, it provides native support for LaTeX math rendering, configurable typography and theme systems, and iOS context menus. It also includes built-in hooks for analytics and interaction tracking. Developers can configure global styles through a MarkdownRenderConfig object and implement the MarkdownListener protocol to receive rendering lifecycle events and user interactions.

Performance and Integration

According to Microsoft, performance tests conducted on an iPhone XS showed that even under high-load scenarios with continuous streaming content, the main thread workload was managed more effectively than other common libraries, resulting in no noticeable UI stuttering.

Developers can integrate the library by entering the GitHub repository address and selecting a version via "File — Add Package Dependencies" in Xcode, or by adding the dependency to the Package.swift file. The official GitHub page also provides SwiftUI sample projects featuring streaming demos, configuration interfaces, and log listener implementations.

Summary

Microsoft has open-sourced SwiftStreamingMarkdown, an iOS library optimized for rendering Markdown in real-time environments such as LLM chat interfaces. It solves performance issues by parsing text as it arrives, ensuring smooth animations and low main-thread overhead while supporting advanced features like LaTeX equations and customizable themes.