Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returns optional(+1) #3

Open
ghost opened this issue Sep 16, 2016 · 3 comments
Open

returns optional(+1) #3

ghost opened this issue Sep 16, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 16, 2016

This was very helpful for me.I am new to IOS. I am now migrating to swift 3. In previous version I did not get any optional value. I got output as flag US +1 now I am getting output as US +optional(+1).I need to update the text field with the country selected once the view is ready There is function to change the label text when the picker view triggers select action but How to initially display the country when the view is loaded.Can you please help me with this.

@jfredsilva
Copy link

I have the same issue after migrating to swift 3

@monica18p
Copy link

Try the following change in CountryPicker.swift file it worked for me

func countryNamesByCode() -> [Country] {
...
...
let phoneCode: String! = "+\((phoneNumberUtil?.getCountryCode(forRegion: code))!)"
...
...
}

@Bathibabu
Copy link

Bathibabu commented Jun 27, 2017

Use like this

if let myCodes = phoneNumberUtil?.getCountryCode(forRegion: code) {
            
         let phoneCode : String = String.init(describing: myCodes)
}

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

No branches or pull requests

3 participants