Use Array(data) instead of Data.bytes for CryptoSwift 1.9+ compatibility#78
Merged
marionbarker merged 1 commit intoJun 12, 2026
Conversation
CryptoSwift 1.9.0 removed its `Data.bytes -> [UInt8]` extension (renamed to `byteArray`). On the Xcode 26 SDK, `data.bytes` then resolves to Foundation's new native `Data.bytes`, which returns a `RawSpan` - breaking every crypto call site with errors like: Cannot convert value of type 'RawSpan' to expected argument type 'Array<UInt8>' Value of type 'RawSpan' has no member 'toHexString' Builds pinned to CryptoSwift <= 1.8.5 are unaffected, so this only bites users whose package resolution floats up to 1.9.0/1.10.0 (e.g. after 'Update to Latest Package Versions'). Replace `<data>.bytes` with `Array(<data>)`, which yields the same [UInt8] and compiles against every CryptoSwift version (and doesn't depend on CryptoSwift at all). Verified building OmnipodKit against CryptoSwift 1.10.0 on Xcode 26.5.
|
Should I close this one - #76 ? One difference I'm seeing is that in this PR, in |
This was referenced Jun 12, 2026
Contributor
|
See this testing done in PR #79 |
marionbarker
approved these changes
Jun 12, 2026
marionbarker
left a comment
Contributor
There was a problem hiding this comment.
This code modification was tested in PR #79.
Approve by code review and test
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Xcode 26 with CryptoSwift ≥ 1.9.0, every crypto call site fails to compile:
…30+ errors across
EnDecrypt,O5LTKExchanger,DashKeyExchange,O5KeyExchange, andMilenage.Cause
CryptoSwift 1.9.0 removed its
extension Data { public var bytes: [UInt8] }(renamed tobyteArray). With that extension gone,data.bytesresolves to Foundation's new nativeData.bytes, which returns aRawSpanon the Xcode 26 SDK — not[UInt8].Builds pinned to CryptoSwift ≤ 1.8.5 still have the old extension and are unaffected, so this only bites once a project's package resolution floats up to 1.9.0 / 1.10.0 (e.g. after Update to Latest Package Versions).
Fix
Replace
<data>.byteswithArray(<data>). It produces the identical[UInt8], compiles against every CryptoSwift version, and doesn't depend on CryptoSwift at all (vs. switching to.byteArray, which would require CryptoSwift ≥ 1.9.0).Data.toHexString()calls that were already onDataare left untouched.39 sites across 5 files; no behavior change.
Verification
Built OmnipodKit against CryptoSwift 1.10.0 on Xcode 26.5 → build succeeds, zero
RawSpanerrors. Also builds against the currently-pinned 1.7.1 (Array(Data)is long-standing API).