Skip to content

Major modernization#62

Merged
ainame merged 53 commits intomainfrom
major-bump
Feb 18, 2026
Merged

Major modernization#62
ainame merged 53 commits intomainfrom
major-bump

Conversation

@ainame
Copy link
Copy Markdown
Owner

@ainame ainame commented Feb 17, 2026

Summary

This PR is the major-bump modernization of Swift-WebP and consolidates the key Unreleased work into a single release-ready update.

Highlights

  • Platform and toolchain modernization

    • Aligns the package with modern Swift and updated platform baselines.
    • Refreshes project setup for current development and CI environments.
  • API surface cleanup

    • Standardizes encode/decode usage around explicit format-driven APIs.
    • Clarifies platform helper naming and overall call-site ergonomics.
  • Safer config/status bridging

    • Tightens contracts around raw libwebp mappings.
    • Removes unnecessary optional/failable conversion paths where invariants are expected.
  • Performance and resource tooling

    • Adds benchmark and validation workflows for repeatable performance/resource checks.
    • Improves support for comparing behavior across encode/decode paths.
  • Quality and reliability improvements

    • Expands test coverage (including decode buffer behavior).
    • Simplifies CI to focused macOS/Linux test execution.
    • Improves internal ownership and memory-management consistency.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WebPEncodePixelFormat and WebPDecodePixelFormat enums
  • Test framework migration: Converted entire test suite from XCTest to Swift Testing framework
  • Infrastructure additions: New Benchmark package with WebPBench executable 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.

Comment thread CHANGELOG.md Outdated
Comment thread AGENTS.md Outdated
Comment thread Benchmark/Package.swift
Comment thread Sources/WebP/WebPDecoder.swift
Comment thread .github/workflows/ci.yml Outdated
Comment thread Scripts/compare-with-cwebp.sh Outdated
@ainame ainame changed the title Major bump modernization Major modernization Feb 18, 2026
@ainame ainame merged commit 1782422 into main Feb 18, 2026
4 checks passed
@madsodgaard
Copy link
Copy Markdown

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?

@ainame ainame deleted the major-bump branch February 19, 2026 10:32
@ainame
Copy link
Copy Markdown
Owner Author

ainame commented Feb 19, 2026

@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.

@ainame
Copy link
Copy Markdown
Owner Author

ainame commented Feb 19, 2026

@madsodgaard It works with previous deployment target at leat on CI. Please check this out and give it a try.
https://github.com/ainame/Swift-WebP/releases/tag/0.6.1

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants