Repository navigation
IWA Protobuf Schemas
SwiftText's Pages (iWork) support is built on typed wire models generated
from Apple iWork (Pages/Numbers/Keynote) protobuf archive schemas. The .proto
schemas themselves are not vendored in this repository — only the Swift wire
models generated from them are committed, under
Sources/SwiftTextPages/Generated/IWA/. Those generated encoders/decoders are
SwiftText's own (backed by ProtobufReader / ProtobufWriter); no protobuf
runtime dependency is introduced.
The schemas are reverse-engineered from the iWork app binaries' embedded protobuf descriptors and are published by:
-
psobot/keynote-parser — https://github.com/psobot/keynote-parser
(MIT License). The relevant files live under
protos/versions/14.4/: the.protoschemas plusmapping.py, which maps IWA type numbers → message types.
Upstream license: MIT — see the keynote-parser repository for the full license text and copyright. SwiftText distributes only its own generated Swift derived from these schemas, not the schema files.
The committed models cover the subset needed for Pages document content — TSP,
TSS, TSD, TSWP, TST, TSK, plus TSCE (calculation engine) and TSCK
(collaboration). References into still-un-modeled archives (charts TSCH, Keynote
KN, Pages-app TP types, and the transient command/undo archives) decode through
a lossless unknownFields passthrough, so any document still round-trips
byte-for-byte.
Scripts/GenerateIWAModels.swift is an in-house proto2→Swift generator. Because
the schemas are no longer in-tree, fetch them from upstream first:
-
Clone or download the schemas from the repository above and locate the
protos/versions/14.4/directory (the.protofiles andmapping.py), e.g. into/tmp/iwork-protos/. -
Run the generator, pointing it at that directory:
swift Scripts/GenerateIWAModels.swift /tmp/iwork-protos Sources/SwiftTextPages/Generated/IWA
This rewrites Sources/SwiftTextPages/Generated/IWA/*.gen.swift in place.
Generated from Docs/IWA-PROTOBUF-SCHEMAS.md in the repo; edit via a merge request.