Skip to content

Releases: swift-foundations/swift-pdf

1.0.5

Choose a tag to compare

@coenttb coenttb released this 31 Mar 16:24

visionOS Support

Adds visionOS as a supported platform. Closes #27.

Changes

  • Added os(visionOS) to platform guards for Metrics DependencyKey, test dependency key, and WKWebView configuration
  • Added .visionOS(.v1) to the platforms array in Package.swift
  • Added visionOS CI job (debug build + test on visionOS Simulator)

Details

All existing UIKit printing APIs (UIPrintPageRenderer, UIMarkupTextPrintFormatter, UIGraphicsBeginPDFContextToData, viewPrintFormatter()) are available on visionOS — the iOS code path works as-is. No separate visionOS implementation was needed.

The root cause was that PDF.Render.Metrics's DependencyKey conformance was guarded by #if os(macOS) || os(iOS), which excludes visionOS. On visionOS canImport(UIKit) is true (so the iOS implementation compiled) but os(iOS) is false (so the metrics conformance was missing).

1.0.4

Choose a tag to compare

@coenttb coenttb released this 19 Dec 17:58

What's Changed

  • Lowered: Platform requirements to macOS 13+, iOS 16+ (#21) - thanks @loparker-CLGX!
  • Updated: swift-resource-pool dependency to 0.1.3+ for macOS 13 support

Full Changelog: 1.0.3...1.0.4

1.0.3

Choose a tag to compare

@coenttb coenttb released this 05 Nov 12:04

Bug Fixes

Swift 6 Concurrency Safety

Fixed task-local value binding issues that could cause runtime errors with Swift 6's strict concurrency checking.

Technical Changes:

  • Fixed dependency value capture in async rendering tasks (iOS & macOS)
  • Enabled StrictConcurrency feature flag on HtmlToPdfLive target
  • Added comprehensive Swift6ConcurrencyTests suite (6 test cases)
  • Replaced intermediate reference variables with proper capture lists
  • Verified full compliance with Swift 6 strict concurrency mode

Impact:

  • Eliminates potential runtime crashes when using @dependency in concurrent contexts
  • Provides regression testing for task-local binding edge cases
  • Ensures library remains forward-compatible with future Swift concurrency improvements

Resolves #16. Thank you @YasserB94 for identifying and fixing this critical concurrency issue.


Improvements

iOS CI Testing Infrastructure

Added comprehensive iOS simulator testing to continuous integration.

Technical Changes:

  • iOS Debug builds tested on every PR/push
  • iOS Release builds with strict concurrency verification
  • Dynamic simulator selection (first available iPhone)
  • Matches macOS test coverage (skips Performance/Stress/Memory tests)
  • Platform-agnostic test suite (no hardcoded platform references)

Benefits:

  • Catches iOS-specific regressions before release
  • Ensures UIKit codepath (UIPrintPageRenderer, WKWebView) works correctly
  • Verifies cross-platform compatibility of rendering logic

CI/CD & Tooling

  • Pinned SwiftLint to 0.62.2 for consistency
  • Improved GitHub Actions caching strategy
  • Added Swift 6.2 as minimum required version
  • Enhanced API breaking change detection workflow
  • Migrated formatting workflows to Linux runners for performance

Internal Changes

  • Code formatting improvements (swift-format)
  • Documentation accuracy improvements
  • SwiftLint configuration refinements
  • Removed obsolete Package@swift-6.0.swift file
  • Enhanced test isolation and reliability

Verification

All changes tested on:

  • macOS 14+ (Debug & Release, Xcode 26.0, Swift 6.2)
  • iOS 17+ (Debug & Release, iOS Simulator, Swift 6.2)
  • Swift 6 Strict Concurrency Mode enabled

Contributors

Thank you @YasserB94 for #17.


Full Changelog: 1.0.2...1.0.3

1.0.1 - Swift 6.0 Package Resolution Fix

Choose a tag to compare

@coenttb coenttb released this 30 Oct 12:20

Bug Fixes

🐛 Swift 6.0 Package Resolution (#12)

Fixed package resolution failures for Swift 6.0 users caused by incorrect dependency version constraints.

Changes:

  • ✅ Removed non-existent pointfree-html dependency (was requiring v0.1.0 which doesn't exist)
  • ✅ Fixed swift-logging-extras version: 0.1.10.0.1 (correct published version)
  • ✅ Mirrored Swift 6.1 three-target architecture (HtmlToPdfTypes, HtmlToPdfLive, HtmlToPdf)
  • ✅ Added swift-html as standard dependency for Swift 6.0 (traits unavailable in 6.0)
  • ✅ Used .define("HTML") compiler flag to enable HTML-guarded code without traits

🔧 CI/CD Improvements

Enhanced continuous integration to catch similar issues in the future:

  • ✅ Added dedicated macOS job to explicitly test Package@swift-6.0.swift
  • ✅ Added swift package resolve step to Linux job (fails fast on version mismatches)
  • ✅ Improved job naming to clarify Swift version/manifest being tested
  • ✅ Separate cache keys for Swift 6.0 and 6.1 builds

Verification

The package now builds and tests successfully with both manifests:

  • Package.swift (Swift 6.1+ with optional HTML trait support)
  • Package@swift-6.0.swift (Swift 6.0 with HTML always enabled)

Thanks

Special thanks to @YasserB94 for reporting this issue!


Full Changelog: 1.0.0...1.0.1

swift-html-to-pdf 1.0.0

Choose a tag to compare

@coenttb coenttb released this 08 Oct 06:22

🚀 swift-html-to-pdf 1.0.0

Production-ready HTML to PDF generation for Swift with exceptional performance.

⚡ Performance

  • 1,939 PDFs/sec (continuous mode)
  • 677 PDFs/sec (paginated mode)
  • 35 MB constant memory (4-24 concurrent workers)
  • Zero memory leaks - tested with 1M+ PDFs

✨ What's New

Complete rewrite built on Swift 6 strict concurrency and Dependencies pattern:

  • 5x performance improvement over 0.x
  • Constant memory usage regardless of concurrency level
  • Simpler API - One dependency property, accessible everywhere
  • Full Sendable guarantees - Zero data races possible
  • WebView resource pooling - Pre-warmed instances with automatic lifecycle management
  • Streaming results - Process PDFs as they're generated
  • Production metrics - Built-in swift-metrics integration
  • Comprehensive documentation - 2,492 lines of DocC guides

📦 Installation

dependencies: [
    .package(url: "https://github.com/coenttb/swift-html-to-pdf.git", from: "1.0.0")
]

Optional: Enable type-safe HTML DSL

.package(
    url: "https://github.com/coenttb/swift-html-to-pdf.git",
    from: "1.0.0",
    traits: ["HTML"]
)

📚 Documentation

🧪 Testing

  • 102 test functions across 23 test suites
  • Stress-tested with 1M PDFs
  • Zero OOM errors in production

⚠️ Breaking Changes

This is a complete rewrite. Migration from 0.x required. Expected migration time: <10 minutes for projects using dependency injection patterns.

📋 Requirements

  • Swift 6.0+
  • macOS 14.0+ or iOS 17.0+
  • Xcode 16.0+

v0.5.0 - iOS Batch Printing & Performance

Choose a tag to compare

@coenttb coenttb released this 29 Sep 13:20

Features

  • iOS batch printing support with WebView pool for concurrent document processing
  • Comprehensive documentation for PrintingConfiguration API in README
  • Feature parity between iOS and macOS platforms for batch printing
  • This CHANGELOG file to track version history
  • Error handling with new PrintingError type for better debugging
  • CI/CD workflows for automated testing and releases
  • GitHub issue templates and contribution guidelines

Performance Improvements

  • Test execution reduced from 28-39 seconds to 2.4 seconds
  • Enhanced WebView pool management with better resource utilization
  • Optimized concurrent document processing

Bug Fixes

  • Task group sequential execution bug that prevented proper concurrent processing
  • NSPrintOperation crashes on macOS (replaced with WKWebView.createPDF() API)
  • Continuation double-resume crashes with thread-safe ContinuationHandler actor
  • WebView pool race conditions with proper initialization synchronization

Infrastructure

  • Multi-platform CI testing (macOS, iOS, Linux, Windows)
  • Automated release workflow with artifact generation
  • Benchmark testing for performance tracking
  • Documentation generation and GitHub Pages deployment

0.4.0

Choose a tag to compare

@coenttb coenttb released this 06 Mar 08:43

This release makes several key improvements to the PDF generation functionality:

  • Refactor WebViewPool using Dependencies framework and a proper Swift actor
    to better handle concurrency and resource sharing
  • Fix the task processing in PDF generation to properly run tasks concurrently
    instead of waiting for each one to complete
  • Add proper error handling and resource cleanup in WebView operations
  • Improve test reliability with better cleanup and verification
  • Add documentation about WebKit process assertion warnings in README

These changes fix issues with concurrent PDF processing where tests would hang
or fail when generating multiple PDFs simultaneously. The actor-based approach
provides better isolation and safer state management for the WebView pool.

Technical details:

  • Added swift-dependencies package for dependency injection
  • Created WebViewPoolActor with proper isolation and continuation handling
  • Fixed resource leaks by ensuring WebView release in error cases
  • Added explanation for WebKit assertion warnings in non-UI contexts

Full Changelog: 0.3.0...0.4.0

0.3.0

Choose a tag to compare

@coenttb coenttb released this 08 Sep 20:19

What's Changed

New Contributors

Full Changelog: 0.2.1...0.3.0

0.2.1

Choose a tag to compare

@coenttb coenttb released this 02 Sep 07:27

Full Changelog: 0.2.0...0.2.1

0.2.0

Choose a tag to compare

@coenttb coenttb released this 18 Jul 15:05

Introducing overloads that return an AsyncSequence that yield the URL of each printed PDF. This enable asynchronous handling of each PDF’s creation, allowing immediate processing of each file’s URL as it’s generated. This is useful for tasks like uploading, logging, or further processing, enhancing efficiency and scalability when dealing with multiple PDFs.

Full Changelog: 0.1.6...0.2.0