'Use xcconfig string list in info.plist array

How can I reference a list of strings defined in an .xcconfig file and expose it in my info.plist variables?

Say I have a list of names in my .xcconfig:

PLAYER_NAMES = "Bob" "Jorge" "Susan" "Dani"

When I look at my project's Build Settings -> User Defined section I see a key called PLAYER_NAMES. The value seems to show multiple strings:

"Bob" "Jorge" "Susan" "Dani"

I would like to access this from my app at run-time. To my knowledge the best way to do this is add an entry into info.plist. The issue I hit is I do not know how to reference the string list. I really do not want to have an individual variable for each name in this list so I actually do want the list itself.

I've read up on how to this with simpler values that are not lists, but am stumped on how to do this for a list value.

TLDR: How can I put the contents of a string list called PLAYER_NAMES from a .xcconfig into my info.plist so that I can access it in the app at runtime via Bundle.main.infoDictionary["PLAYER_NAMES"] or something similar.

ios


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source