Problem occurs with Xcode 12.4 (12D4e). Eight properties good, nine properties bad:
import Foundation
public struct Foo: Codable {
public let a01: String
public let a02: String
public let a03: String
public let a04: String
public let a05: String
public let a06: String
public let a07: String
public let a08: String
public let a09: String
}
let foo = Foo(a01: "foo",
a02: "foo",
a03: "foo",
a04: "foo",
a05: "foo",
a06: "foo",
a07: "foo",
a08: "foo",
a09: "foo")
do {
let encoder = JSONEncoder()
let data = try encoder.encode(foo)
if let jsonString = String(data: data, encoding: .utf8) {
print(jsonString)
}
} catch {
print(error)
}
Exception as follows:
CoderBug.xcplaygroundpage: error: Playground execution aborted: error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=EXC_I386_GPFLT).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
Topic:
Programming Languages
SubTopic:
Swift
Tags: