Hello,
I'm working on a reference / informational style app and I'm not sure what the correct practice is for storing a lot of data thats predetermined and unlikely (but possible) to change.
A good example of something similar to what I'm working on is a wikipedia page.
Let's say I built a struct for managing this data, and all of the information above is can be broken down and placed into the struct for use.
Currently, I have all of this information in different files and as global constants.
Currently it's working fine. However I'm planning on having over 500 different files / constants filled with data once the app is fully built.
My questions are:
Note:
I did come across this SwiftUI tutorial by Apple and it's also a good example of what I'm trying to accomplish. What they did inside of it is wrapped up the data in JSON, and then had a codable struct to match it to. Would that be a better approach?
I'm working on a reference / informational style app and I'm not sure what the correct practice is for storing a lot of data thats predetermined and unlikely (but possible) to change.
A good example of something similar to what I'm working on is a wikipedia page.
Let's say I built a struct for managing this data, and all of the information above is can be broken down and placed into the struct for use.
Currently, I have all of this information in different files and as global constants.
Code Block Swift Water.swift let water = MyStruct(...)
Code Block Swift Ice.swift let ice = MyStruct(...)
Code Block Swift Steam.swift let steam = MyStruct(...)
Currently it's working fine. However I'm planning on having over 500 different files / constants filled with data once the app is fully built.
My questions are:
Is having a large amount of global constants bad? (even though they are lazy)
Whats the best practice for storing this data?
Note:
I did come across this SwiftUI tutorial by Apple and it's also a good example of what I'm trying to accomplish. What they did inside of it is wrapped up the data in JSON, and then had a codable struct to match it to. Would that be a better approach?