I would like to generate a list of all Locale identifiers for the user to select as a default. Similar to selecting the region in the standard settings.
Thus I would like to generate a list that would contain e.g. "Australia", "Austria", "Azerbaijan", ... ,"Yemen", "Zambia", "Zimbabwe". If the user selects "Australia" I would like to return en_AU
.
So need to identify the property under Locale
that can be used and how to iterate through it.
Currently, just trying to see if I can return the text e.g. "Australia":
Text(Locale.localizedString(Locale.init(identifier: Locale.availableIdentifiers[0].description)))
However returning error:
Closure containing control flow statement cannot be used with function builder 'ViewBuilder'
Thank you