Skip to content

Conversation

@emoonadev
Copy link
Contributor

@emoonadev emoonadev commented Nov 24, 2023

This pull request introduces a new mode to the existing Country Code Picker screen that allows it to function as a Currency Picker. This dual functionality enhances user flexibility, enabling seamless switching between selecting country codes and currencies within the same interface.

Key Changes:

  • Added a new mode to the Country Code Picker screen for currency selection.
  • Implemented necessary UI updates to accommodate both modes.
  • Ensured seamless toggling between country code and currency picking functionalities.

This feature aims to improve user experience by providing a more versatile and efficient interface for selecting country-specific details.

To use it simply use the new init:

CountryPickerViewController(pickerMode: .currency)
CountryPickerViewController(pickerMode: .countryCode)
CountryPickerViewController() // Picker mode will be country code
Screenshot 2023-11-24 at 16 03 35

Copy link
Contributor

@Rashidium Rashidium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @emoonadev ,

Thank you for your contribution. I liked the idea of your request feature. I'm sure it'll be useful for the community.

I've some comments though, to kindly ask you to make some changes on the implementation. New feature brings some if-else's which can lead to messy code base in the future. To avoid, we can create 2 different structs conforming to the same protocol, to be more specific, ListItem protocol children, Country and Currency.

ListItem, should have some common items for both Country and Currency.

  • code: currently isoCode and currencyCode respectively. Here I would like you to confirm whether isoCode and currencyCode are same? As they both use .getFlag function. If they're same, let's use same value for both.
  • name: currently localizedName, localizedCurrencyName
  • currencyCode: currently +phoneCode and currencyCode+currencySymbol

After this, removing picker mode from TableViewCell would be logical and some refactorings on CountryPickerViewController will be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants