Skip to content

Use Array(data) instead of Data.bytes for CryptoSwift 1.9+ compatibility#79

Open
marionbarker wants to merge 1 commit into
mainfrom
fix/cryptoswift-1.9-rawspan_wrt_main
Open

Use Array(data) instead of Data.bytes for CryptoSwift 1.9+ compatibility#79
marionbarker wants to merge 1 commit into
mainfrom
fix/cryptoswift-1.9-rawspan_wrt_main

Conversation

@marionbarker

Copy link
Copy Markdown
Contributor

This PR cherry-picks the commit from PR #78 which is applied to the loop-next-dev branch so the fix is available for the main branch. The rest of the description comes from the cherry-pick.

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

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.
@marionbarker marionbarker requested a review from itsmojo as a code owner June 12, 2026 00:34

@itsmojo itsmojo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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