Skip to content

Commit 54b6113

Browse files
itaybreWhiteHyun
andauthored
fix: SPM manifest compilation on Swift 6.1 (#7819)
`String(cString:encoding:)` is a Foundation extension on `String` and is not available in the SwiftPM manifest context, where only `PackageDescription` is imported. On Swift 6.1 / Xcode 16+, `swift package resolve` now fails with: error: extra argument 'encoding' in call Use the stdlib `String(cString:)` initializer, which already decodes as UTF-8 and matches the original intent. --------- Co-authored-by: SeungHyun Hong <whi7ehyun@gmail.com>
1 parent 12f4d33 commit 54b6113

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Fix `Package@swift-6.1.swift` SPM manifest compilation on Swift 6.1 / Xcode 26 (#7800, #7819)
8+
39
## 8.58.1
410

511
### Fixes

Package@swift-6.1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var targets: [Target] = [
6969
]
7070

7171
let env = getenv("EXPERIMENTAL_SPM_BUILDS")
72-
if let env = env, String(cString: env, encoding: .utf8) == "1" {
72+
if let env = env, String(cString: env) == "1" {
7373
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
7474
targets.append(contentsOf: [
7575
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system

0 commit comments

Comments
 (0)