Skip to content

Commit e34ab01

Browse files
authored
[Swift 6] Fix mutable state error in FirebaseDataEncoder.swift (#14556)
1 parent 630c98c commit e34ab01

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/shared-swift.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ jobs:
3131
- os: macos-15
3232
xcode: Xcode_16.2
3333
swift_version: 5.9
34-
# - os: macos-15
35-
# xcode: Xcode_16.2
36-
# swift_version: 6.0
34+
- os: macos-15
35+
xcode: Xcode_16.2
36+
swift_version: 6.0
3737
runs-on: ${{ matrix.build-env.os }}
3838
steps:
3939
- uses: actions/checkout@v4

FirebaseSharedSwift/Sources/third_party/FirebaseDataEncoder/FirebaseDataEncoder.swift

+8
Original file line numberDiff line numberDiff line change
@@ -2611,11 +2611,19 @@ fileprivate struct _JSONKey : CodingKey {
26112611
//===----------------------------------------------------------------------===//
26122612

26132613
// NOTE: This value is implicitly lazy and _must_ be lazy. We're compiled against the latest SDK (w/ ISO8601DateFormatter), but linked against whichever Foundation the user has. ISO8601DateFormatter might not exist, so we better not hit this code path on an older OS.
2614+
#if compiler(>=6)
2615+
nonisolated(unsafe) fileprivate var _iso8601Formatter: ISO8601DateFormatter = {
2616+
let formatter = ISO8601DateFormatter()
2617+
formatter.formatOptions = .withInternetDateTime
2618+
return formatter
2619+
}()
2620+
#else
26142621
fileprivate var _iso8601Formatter: ISO8601DateFormatter = {
26152622
let formatter = ISO8601DateFormatter()
26162623
formatter.formatOptions = .withInternetDateTime
26172624
return formatter
26182625
}()
2626+
#endif
26192627

26202628
//===----------------------------------------------------------------------===//
26212629
// Error Utilities

0 commit comments

Comments
 (0)