Since I have several country fields in my form (for mobile, country of passport, user address, etc.), it doesn't make sense to configure these values on a singleton. Every field has its own settings (title, for example, showing phone code, etc.), and all are created at the same time. I think it would be a better idea to support "config" as a parameter that can be set in the UIViewControllerRepresentable struct that you offer as an example:
struct CountryPicker: UIViewControllerRepresentable {
[...]
@Binding var country: Country?
var config: Configuration?
Alternatively, we could allow setting these values directly in the CountryPickerViewController, like selectedCountry.
Since I have several country fields in my form (for mobile, country of passport, user address, etc.), it doesn't make sense to configure these values on a singleton. Every field has its own settings (title, for example, showing phone code, etc.), and all are created at the same time. I think it would be a better idea to support "config" as a parameter that can be set in the UIViewControllerRepresentable struct that you offer as an example:
Alternatively, we could allow setting these values directly in the CountryPickerViewController, like selectedCountry.