Skip to content

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

Merged
marionbarker merged 1 commit into
mainfrom
fix/cryptoswift-1.9-rawspan_wrt_main
Jun 12, 2026
Merged

Use Array(data) instead of Data.bytes for CryptoSwift 1.9+ compatibility#79
marionbarker merged 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

@marionbarker

Copy link
Copy Markdown
Contributor Author

Test

✅ Successful test

Reproduce the issue, then Demonstrate the fix

Reproduce the issue reported from iAPS when they modified the CryptoSwift minimum Version from 1.4.1 to 1.10.0 in OmnipodKit.xcodeproj/project.pbxproj

repositoryURL = "https://github.com/krzyzanowskim/CryptoSwift";
			requirement = {
				kind = upToNextMajorVersion;
				minimumVersion = 1.10.0;
			};

Method

Build Loop main branch with no changes to any submodules

  • ✅ successful build

Modify OmnipodKit.xcodeproj/project.pbxproj to change the minimumVersion with no other changes

  • build failed as reported by iAPS
  • screenshot showing a few of the errors shown below
Screenshot 2026-06-12 at 3 02 21 PM

Change to fix/cryptoswift-1.9-rawspan_wrt_main branch while leaving the minimumVersion at 1.10.0

  • ✅ successful build
  • ✅ ensure that an rPi DASH pod pairs as expected with this configuration
    • the following worked as expected: Deactivate, Pair/Prime, Insert, Bolus, set Manual Temp Basal

Reset the change to OmnipodKit.xcodeproj/project.pbxproj to restore the minimumVersion to 1.4.1

  • This test is just the fix/cryptoswift-1.9-rawspan_wrt_main version, i.e., modifications from this PR
  • ✅ successful build
  • ✅ ensure that an rPi DASH pod pairs as expected with this configuration
    • the following worked as expected: Deactivate, Pair/Prime, Insert, Bolus, set Manual Temp Basal

@marionbarker marionbarker merged commit 80069aa into main Jun 12, 2026
marionbarker added a commit that referenced this pull request Jun 13, 2026
Use Array(data) instead of Data.bytes to support newer CryptoSwift (#79)
@marionbarker marionbarker deleted the fix/cryptoswift-1.9-rawspan_wrt_main branch June 13, 2026 12:41
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