I have UISearchBar in UITableView as a table header. When I push the UISearchBar for start searching, this method is being triggered>
UISearchBar
UITableView
Your cursor is white because your tintColor property on UISearchBar is set to white.
If you want Cancel btn to be white, but cursor to be black you can use: UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).tintColor = .black
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).tintColor = .black