The app has login page, to be able to login user clicks on the animation "Select your country". When user clicks on that, country list as picker appears as pop-up. Here the first country is Afghanistan and the picker is already on it, but when user clicks OK, it does not select it because as you know picker works if you scroll down or up.
Now I want to set the first object (in my case it is Afghanistan) from the array default selected.
Here is the code:
@IBAction func chooseCountryClicked(_ sender: Any) {
let alert = AlertFactory.alert(title: ExampleLocalizedString.getLocalizedString("choose_country"),
pickerStrategy: CountryPickerStrategy(withInitialCode: selectedCountryCode),
delegate: self)
self.present(alert, animated: false, completion: nil)
}
I have a variable for:
var selectedCountryCode: String?
I hope that I explained myself good enough.
Appreciate your help. Thanks.