chronotruck / FlagPhoneNumber

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

Differentiate between Mobile Phone and Telephone #179

Closed ahsan-khalil closed 3 years ago

ahsan-khalil commented 3 years ago

Describe the solution you'd like Since mobile OTP work on mobile phone only, So, when user completes his number in textField, I want to differentiate whether the user entered telephone number or mobile phone number, so if the user entered telephone number then I can show a related error to him so that he only adds his mobile number.

ahsan-khalil commented 3 years ago

Got a solution for it.

`do {

 let util = NBPhoneNumberUtil()
 let number = try util.parse("+923351234567", defaultRegion: "PK")
 if util.getNumberType(number) == .MOBILE {
       print("mobile type")
 } else {
        print("other type")
 }

} catch { print("cant parse") } `