After updating to Appium 2 I am unable to compare and check if the platform is Android or iOS

I kind of re-wrote the code like this

if(driver instanceof AndroidDriver)

Reference link: