I have a SwiftUI/SpriteKit game in which each level is described by properties of a tuple in an array literal. There are about 150 tuples so far, with each tuple containing about 20 properties.
The problem is, this big array literal causes Xcode to build very slowly. It takes something like 5+ minutes to build my project. If I block out the array, the build time is almost instantaneous.
I think this is due to type inference -- however, I'm explicitly setting the types, like this:
class MainData: ObservableObject {
private var levels: [(firstKey: Int, secondKey: String)] = [
(
firstKey: 0,
secondKey: "something"
),
(
firstKey: 0,
secondKey: "something"
)
]
}
Am I doing something wrong? Is there anything I can do to this array to speed up my build times?
Thank you!
Update: After adding some more tuples, Xcode will actually stop responding and my (brand new, desktop) Mac will run out of application memory.