[ios] removing use of instanceof