We have released HavenGPXParser, an open source Swift package for working with GPX files.

It reads, validates, and writes GPX 1.1 documents. The parser uses streaming so large files do not fill up memory.

You can check a GPX file against the 1.1 standard and get clear error messages when something is wrong. You can also build GPX documents in code and export them as XML.

The package comes with SwiftUI views for drawing tracks and waypoints on a map through MapKit.

It guards against XML attacks with limits on entity expansion, nesting depth, and file size.

The code is on GitHub under the BSD 3-Clause licence.