We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bbc715c commit 50dfdcaCopy full SHA for 50dfdca
sources/declarative/encodable/containers/SingleValueEncodingContainer.swift
@@ -191,8 +191,15 @@ extension ShadowEncoder.SingleValueContainer {
191
mutating func encode(_ value: Decimal) throws {
192
switch self._encoder.sink._withUnsafeGuaranteedRef({ $0.configuration.decimalStrategy }) {
193
case .locale(let locale):
194
- var number = value
195
- let string = NSDecimalString(&number, locale)
+ let nf = NumberFormatter()
+ nf.numberStyle = .decimal
196
+ nf.locale = locale
197
+ let string = nf.string(from: NSDecimalNumber(decimal: value))
198
+
199
+ // This is crashing in Xcode 16b5
200
+// var number = value
201
+// let string = NSDecimalString(&number, locale)
202
203
try self.encode(string)
204
case .custom(let closure):
205
try closure(value, self._encoder)
0 commit comments