Archiving iOS project with a struct with hundreds properties takes forever to compile

Hey Folks,
we experienced a massive slowdown in archiving our app with a growing struct with a lot of properties in it.
We use a json to codable struct construct to handle our translations/localization in our app.
With a growing amount of properties in this struct, the archiving time grows up to 120-150 min.
The debug compile times are always pretty decent and on a low level at 4-6 min.

Here is how the struct looks like:

struct Translation: Codable {
    var aboutAdvantages = ""
    var aboutEnvironmentText = ""
    // Another 800+ properties
    var youHaveOneOpenOrder = ""
    var youHaveOpenOrdersHeadline = ""

This translation struct is used in pretty much in every view in the application and some services and converter/mapper/view models.

import SwiftUI

extension View {
    var translation: Translation {
        // logic to get the translation from the dependency injection contianer

struct SampleView: View {
    var body: some View {

Now we figured out that changing this to an enum based system like the code below is improving the archiving speed very drastically down to around 5-6 min.

struct Translation {
    private var translations: [String: Any]

    init(translations: [String: Any]) {
        self.translations = translations

    enum Keys: String {
        case aboutAdvantages
        case aboutEnvironmentText
        // Another 800+ fields
        case youHaveOneOpenOrder
        case youHaveOpenOrdersHeadline
    func t(_ key: Keys) -> String {
        if translations[key.rawValue] == nil {
            return "Key is missing \(key.rawValue)"

        return translations[key.rawValue] as! String

struct SampleView: View {
    var body: some View {

I assume that optimization on the archive build got crazy at some point and need to do a huge amount of extra rounds because of this big fat beefy struct property class.

Is there an explanation for this that a normal non-compiler programmer can understand these circumstances?

Here are some data:
swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang- clang-1316.0.20.12)
Target: arm64-apple-macosx12.0
Xcode Version 13.4.1 (13F100)
Let me know if someone needs more information regarding this topic.

Thanks a lot for your time :)

Hi. Is it just archiving, or is it compilation in release builds as well (use Xcode's "Edit Scheme" to change between debug / release building)? Not an answer, but while you are on this: can you easily change the number of fields (e.g. by commenting out the relevant code sections) and plot the actual graph of compilation time vs number of fields? I wonder if that would be liner or quadratic or worse.

I found that SwiftUI system in particular is suspect-able to long compilation times (e.g. there's some error in code but instead of reporting it quickly SwiftUI compilation just times-out) - but for me that's only happening in erroneous scenarios when the build is actually failing.

Hey i have checked it. A build in release is also taking very long. I have no final numbers yet because it is right now still building but i am already above 1 hour. The build time was already high before we even had one line of SwiftUI in out app. So SwiftUI is at least not the root cause of this problem.

Update: The build took in release mode 132min.