How to use different values ​​for variables for different purposes of the same Xcode project?

I have a project with the same code base for different purposes, which require different values ​​for some variables. What is the best way to achieve this? Here are my thoughts:

  • Use a different property list resource that contains values ​​for each target. Con: I need to parse a list of properties at runtime to get the values. The values ​​are displayed in clear form if someone is looking inside the application package.
  • Use #define in different include files. Con: For each new goal, I have to use macro correspondences to include the correct file in the implementation.
  • Use a different implementation file for each purpose:
    • with constant global variables. Con: The namespace is polluted by these global variables.
    • with a class whose properties are variables. Con: Each implementation must rewrite the glue code for the properties.

Does anyone have a good solution? Or is it better to include a common code base in the library and use different projects each time?

+4
source share

All Articles