4

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

  • Use a different property list resource containing the values for each target. Con: I have to parse the property list at runtime to get the values. The values appear in clear if someone looks inside the application bundle.
  • Use #defines in different include files. Con: For each new target, I have to use macro conditionals to include the correct file in the implementation.
  • Use a different implementation file for each target:
    • with constant global variables. Con: The namespace is polluted by these global variables.
    • with a class whose properties are the variables. Con: Each implementation has to rewrite the glue code for the properties.

Does anyone has a good solution? Or is better to factor the common code base into a library and use different projects each time?

Guillaume
  • 4,331
  • 2
  • 28
  • 31

0 Answers0