For temporary views you can use Catalog.dropTempView:
For global views you can use Catalog.dropGlobalTempView:
Just note that if view doesn't exist both the methods are safe to call and, since Spark 2.1, return boolean indicating if the operation succeeded.
You can use SQLContext.dropTempTable:
It can be still used in Spark 2.0, but delegates processing to Catalog.dropTempView and is safe to use if table doesn't exist.