1

I was wondering if such a thing was available; I'm used to developing Android for apps, Gui wise in web you obviously go for css, in android you have the styles and config files for strings, ints colors etc.

Now, what would be "The best" option to use such a thing for iOS?

I have this project with multiple targets, which I now separate in a targets folder to contain their custom style and images. (I'm not sure how to note the styles yet). What I'd like to have is to have some settings which I can easily edit for every single target. Settings will be stuff like, text colors, navbar color, login-background-image etc. The images I'll handle by just putting these in either assets or loosely in those dirs.

what to use for dimensions, strings, colors etc.? I'm fine with reading it with a style class parsing values if needed.

Mathijs Segers
  • 6,168
  • 9
  • 51
  • 75

1 Answers1

1

You can use the "User-Defined" section in the Build Settings of your target to store dimensions, string, and colors. Use the "+" button to add new user-defined values.

enter image description here

By the way, I like to use .xcconfig files to store User-Defined values.

1:Create a new configuration settings file. enter image description here

2:Assign your new configuration settings file to a target. enter image description here

3:Add some values in the configuration settings file enter image description here

4:The values should be inserted into build settings as User-Defined values automatically. enter image description here

For images, you can put them in different folders for different target and select the target the images belong to in the "Target Membership" section in the file inspector.

enter image description here

Peter Zhou
  • 3,881
  • 2
  • 21
  • 19
  • 1
    As far as I can see, storing colors in user defined will not work since you cannot fetch those as variable. Just create conditions which will be hard for 255*255*255 colors – Mathijs Segers Mar 27 '15 at 13:03
  • @mathijsSegers You can create a method or a macro to convert strings to UIColor objects. For example, http://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string – Peter Zhou Mar 27 '15 at 20:21
  • @mathijsSegers If editing text is easier for you, you can store the values in .xcconfig files. Please see updated answer. – Peter Zhou Mar 27 '15 at 20:43
  • ic, well I looked around a bit, and I got them in code right now, so it seems to work fine, just have to convert colours ofcourse. – Mathijs Segers Mar 28 '15 at 00:31