I have done it as
let searchTextField: UITextField? = (searchBar.value(forKey: "_searchField") as? UITextField)
searchTextField.textAlignment = .right
its working fine on IOS version <= 9.3
but problem in IOS version > 9.3
any help will be appreciated.
Thanks