chronotruck / FlagPhoneNumber

A formatted phone number UITextField with country flag picker.
Apache License 2.0
437 stars 318 forks source link

setCountries problem #138

Open ahmedMaher3 opened 4 years ago

ahmedMaher3 commented 4 years ago

Hi Dear I searched a lot before submitting this issue but I couldn't find any solution In my application i get supported countries through an API , so I have to set countries with string country codes but this FlagPhoneNumber has only one way to set countries and it uses an enum its like this: falg_phone_number.setCountries(including: [.FI, .SE])

I really need a method to set countries using a Int like this: iknow that there is method do that but it is work wrong example flag_phone_number.setCountries([+966]) return nil Reportedly sudia arabia

please help me if there is a way thanks

mahmutsahinn commented 4 years ago

forexample code is "+90" code = "+90" let countryCode = Int(code) let fpnCountryCode = FPNCountryCode(rawValue: NBPhoneNumberUtil().getRegionCode(forCountryCode: NSNumber(value:countryCode))) flagPhoneNumber.setCountries([fpnCountryCode])