Skip to content

swift-configuration 1.2.0 fails to compile: 'Data' has no member 'bytes' #1

@asielcabrera

Description

@asielcabrera

Description

When building with Swift 6 on macOS 15 (new Foundation), the transitive dependency swift-configuration 1.2.0 fails to compile because it uses Data.bytes, which was removed in the new Foundation framework.

Error

error: value of type 'Data' has no member 'bytes'
  FileProvider.swift:189:37
      data: fileContents!.bytes,

Root cause

swift-configuration 1.2.0 (from Apple, dependency of console-kitvapor) uses the deprecated Data.bytes property to convert Data to RawSpan:

self._snapshot = try snapshotType.init(
    data: fileContents!.bytes,
    providerName: providerName,
    parsingOptions: parsingOptions
)

In the new Foundation (Swift 6 / macOS 15), Data.bytes no longer exists.

Workaround applied

In .github/workflows/tests.yml and .github/workflows/docs.yml we patch the file after dependency resolution:

sed -i '' 's/fileContents!\.bytes/fileContents!.withUnsafeBytes { RawSpan(_unsafeBytes: $0) }/g' \
  .build/checkouts/swift-configuration/Sources/Configuration/Providers/Files/FileProvider.swift

Resolution needed

  • Upstream fix in apple/swift-configuration
  • Or update console-kit / vapor to a version that no longer depends on swift-configuration (or depends on a fixed version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions