Swift Package for using Typst Library in iOS, iPadOS, and macOS applications developed in Swift
- macOS Monterey (12.0) or later
- Xcode 13.0 or later
- rustup
- Rust 1.80.0 or later, installed via rustup
- cargo-swift, installed via
cargo install cargo-swift
- Open the project in Terminal
- Run
cargo swift package
- Keep the default package name
TypstLibrarySwift
and build target macOS and iOS - The Swift package will be built in the
TypstLibrarySwift
directory
This project relies on the following open-source projects:
- cargo-swift for building Swift packages from Rust code
- Typst Libraries for Typst related functionality such as Typst document rendering
This project heavily relies on the implementation of tfachmann/typst-as-library for the Typst Wrapper in Rust, and other implementations to interact with the Typst Library.
To make sure that the Typst Library can render the text whenever the library is used, some fonts are embedded in the Swift package.
They are all open-source fonts, licensed under the SIL Open Font License.
The fonts are:
- CMU* Concrete
- CMU* Sans Serif
- CMU* Serif
- CMU* Typewriter
- IBM Plex Mono
- IBM Plex Sans
- IBM Plex Serif
- STIX Two Math
- LXGW WenKai Mono Lite
- CMU stands for Computer Modern Unicode, which is a derivative of the Computer Modern font family.
By default, the fonts always falls backs to:
- STIX Two Math for mathematical formulas
- IBM Plex Mono for raw text (e.g. code)
- IBM Plex Sans and LXGW WenKai Mono Lite for normal text (LXGW WenKai Mono Lite is used for characters that are not supported by IBM Plex Sans, such as Chinese characters)