Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes Swift-WebP for a major version bump (0.6.0), raising minimum requirements to Swift 6.2, iOS 17+, and macOS 14+. The changes consolidate the API surface by introducing format enums for encoding/decoding, migrate tests from XCTest to Swift Testing, add comprehensive benchmarking infrastructure, and improve memory management with Swift 6 ownership features (~Copyable, Span).
Changes:
- API modernization: Replaced per-format encode/decode methods with unified APIs using
WebPEncodePixelFormatandWebPDecodePixelFormatenums - Test framework migration: Converted entire test suite from XCTest to Swift Testing framework
- Infrastructure additions: New Benchmark package with
WebPBenchexecutable and validation scripts for performance testing
Reviewed changes
Copilot reviewed 39 out of 40 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/WebP/WebPEncoder.swift | Consolidated encode methods into single API with format parameter; added defer for cleanup |
| Sources/WebP/WebPDecoder.swift | Added buffer-based decode APIs and Span-based internals; unified format handling |
| Sources/WebP/WebPMemoryOwner.swift | New ownership type using ~Copyable for safe memory management |
| Sources/WebP/WebPVersion.swift | Added libwebp version query helpers |
| Sources/WebP/WebPError.swift | Added new error cases for config failures and buffer size mismatches |
| Sources/WebP/WebPEncoderConfig.swift | Added losslessPreset and validate methods; improved enum handling |
| Sources/WebP/WebPDecoderConfig.swift | Changed to throwing initializer; added manual init for WebPDecoderOptions |
| Sources/WebP/WebPImageInspector.swift | Changed to enum; added Span-based internal API |
| Sources/WebP/CGImage+Util.swift | Replaced unsafe CFMutableData cast with safer pointer conversion |
| Tests/WebPTests/*.swift | Migrated all tests from XCTest to Swift Testing; added new coverage for buffer APIs |
| Package.swift | Updated to Swift 6.2, iOS 17+, macOS 14+; updated libwebp to 1.5.0 |
| .github/workflows/ci.yml | Added CI for macOS and Linux test validation |
| Scripts/*.sh | Added benchmarking and validation scripts |
| Benchmark/ | New benchmark package with WebPBench executable |
| README.md | Updated with new API examples and requirements |
| CHANGELOG.md | Consolidated unreleased changes with migration guide |
| AGENTS.md, MEMORY_FOOTPRINT.md | New documentation for maintainers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey @ainame The move from minimum iOS deployment of 13 to 17 broke the build for us. Is there a specific reason why this increase was necessary? |
|
@madsodgaard Let me check if I can keep it as it was. It just followed Apple best practice keeping last 2-3 release supported in Apple platform apps (AI did it) but I don't see reason to follow that practice in this kind of library. I didn't expect this project was actually in someone's pipeline since I rarely got feedback. I was careless about it, sorry. |
|
@madsodgaard It works with previous deployment target at leat on CI. Please check this out and give it a try. That said please keep in mind that since this project is still before stable 1.0 version, there would be some breaking changes for good at any time (like this time). Feel free to give me feedback. |
Summary
This PR is the major-bump modernization of Swift-WebP and consolidates the key
Unreleasedwork into a single release-ready update.Highlights
Platform and toolchain modernization
API surface cleanup
Safer config/status bridging
Performance and resource tooling
Quality and reliability improvements