Description
What happened?
Note: I use an older localized version of Web3Swift (based on 2.6.5 based on the changelog). Reported issues might have been resolved in the latest version, but I don't think so.
Description:
Compiling with Xcode 26 beta 2 causes errors related to Data.bytes. This seems due to new availability restrictions and/or .bytes returning a RawSpan-like type, which is incompatible with existing code expecting [UInt8] or direct collection access on bytes.
Affected Methods (Examples):
Utilities.swift:
hashECRecover(hash:signature:)
unmarshalSignature(signatureData:)
ABIElements.swift:
decodeErrorResponse(:errors:) (deprecated method)
Web3+BrowserFunctions.swift (or similar for hooked functions):
personalECRecover(:signature:)
Common Issues in Affected Methods:
Direct usage of someDataSlice.bytes leading to availability errors.
Attempts to pass someDataSlice.bytes (as RawSpan) to functions expecting [UInt8].
Using .count or subscripts on someDataSlice.bytes as if it were an array.
How I solved it locally:
Avoid direct use of .bytes where it causes issues.
Use direct Data object properties and methods (e.g., data.count, data[index], data[range]).
Explicitly convert Data or Data slices to [UInt8] using Array(dataInstance) when an array of bytes is required by other functions (e.g., SECP256K1.marshalSignature).
Use String(data:encoding:) for converting Data slices to String.
What are the steps to reproduce?
Recompile with Xcode Beta 2
What is the expected behavior?
Correct build.
What is the error thrown?
N/A
What's the stack trace said?
N/A
OS version
macOS Version 15.5 (24F74)
Library version
2.6.5