Hi,
I have to translate in swift a finite element for buildings software writen in delphi before.
In this software, there are many global variables (structs, arrays, matrices, enums ...
Do I put them in a isolated swift file as we do for classes or in the main file ?
The second part of my question is more important.
Each building created will have its data in a struct and I would like to save it in a file.
How can I do that ?
Thanks in advance for answers,
Best regards,
Alfred
Is it OSX or IOS App ?
Probably the first question is to analyze if you really need so many globals.
For enum definition, struct definition, no problem. And it may be good to have them in a specific Swift file.
But for var, you should consider whether they should be part of the model associated to an instance of the computation class ; globals bring the risk to be modified by several objects.
For the second question, depending on how complex data model is, you may have to consider a database structure, such as Core Data. Or save data as separate files.