Repository navigation
Releases
Releases · mdzip-project/mdzip-core-swift
mdzip-core-swift 0.1.0
First release of the MDZip (.mdz) core library for Swift: read, write and validate .mdz archives in iPhone and iPad apps (iOS 15 and later), Mac apps (macOS 12 and later) and on Linux, with Swift 5.9 or later.
Add it in Xcode under File → Add Package Dependencies… with https://github.com/mdzip-project/mdzip-core-swift, or in Package.swift:
.package(url: "https://github.com/mdzip-project/mdzip-core-swift.git", from: "0.1.0")import MDZip
let archive = try MDZipArchive(contentsOf: url)
let markdown = try archive.text(at: try archive.entryPoint())- Implements MDZip specification 1.2.1 and the core library contract (R1 to R7): open, inspect, resolve links, validate, create and modify archives. The README maps each requirement to the API.
- Failures are
MDZipErrorvalues with a stablecodesuch asERR_ENTRYPOINT_MISSING. - Safe by default: entry name checks, symbolic links never followed, and resource limits (defaults built in,
MDZipLimitsto change them) checked against the bytes actually decompressed. - Modifying an archive keeps every untouched entry and every unknown manifest field; saving replaces the file atomically.
- One dependency, ZIPFoundation 0.9.20, used only to write archives.
Tested against the specification's v1.2.1 fixtures (all applicable tests pass; T-016 is for renderers) on Linux, macOS and the iOS Simulator. Archives it writes pass mdz validate with no warnings. To run the tests yourself on a Mac, in the iOS Simulator or on an iPhone, see docs/testing-on-mac-and-iphone.md.