Skip to content

Add feature-gated Swift string and buffer APIs - #1

Merged
mrousavy merged 4 commits into
mainfrom
feat/swift-string-apis
Sep 30, 2026
Merged

mrousavy merged 4 commits into
mainfrom
feat/swift-string-apis

Conversation

@mrousavy

@mrousavy mrousavy commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Consumers currently have to build Swift string construction and temporary Unicode buffers around the low-level C API. Add handwritten String and counted-buffer conveniences so that code can live in this package and survive upstream binding regeneration.

  • Add copying/repairing and failable validating UTF-8, UTF-16, and UTF-32 initializers, append methods, and scoped UTF-16/UTF-32 buffers.
  • Add ASCII validation/copying/appending, Latin-1 conversion, Base64 encoding/decoding, and an encoding-detection OptionSet.
  • Gate every public convenience with its required SwiftPM traits. Keep embedded NULs, explicit counts, copied input storage, and closure-scoped temporary output. Retain the short-string optimization and guard newer UTF8Span APIs by compiler and OS availability.

Validation: all 13 feature configurations passed runtime tests, native symbol checks, and positive/negative external Swift API probes; all 28 tests passed in Release and with Address Sanitizer. Xcode Release builds passed for arm64 and x86_64 iOS Simulator. All Swift sources typechecked for x86_64 macOS 10.13 with every feature enabled. GitHub CI passed on macOS (including Address Sanitizer) and Linux with the minimum Swift 6.1 toolchain.

Publish these APIs as package version 1.0.1. Nitro #103 adopts the new methods and will use the versioned release.

@mrousavy
mrousavy merged commit 4f98b5b into main Sep 30, 2026
4 checks passed
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.

1 participant