I am trying to restrict user input to only number when user change its local to "Arabic" language,
Take a look at the
-stringByApplyingTransform:reverse: method, added in iOS 9. The
NSStringTransformLatinToArabic transform will happily convert digits between (the oh-so-confusingly-named)
Arabic and
Eastern Arabic numerals.
If you have to support older platforms you can use
CFStringTransform with
kCFStringTransformLatinArabic.
btw I moved your thread to App Frameworks > Localization because this isn't a Swift-specific problem.
Share and Enjoy
—
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"