mobven / CountryPicker

Country Picker with unicode flags and country codes.
MIT License
66 stars 19 forks source link

Improving Config support with SwiftUI Integration #30

Open ucotta-at-wwm opened 1 month ago

ucotta-at-wwm commented 1 month ago

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.