Get class name of UIViewController in swift
A simple way in swift 3 is to write the below code:
for instances:
let className = String(describing: self)
for classes:
let className = String(describing: YourViewController.self)
The cleanest way without needing to know the name of your class is like this.
let name = String(describing: type(of: self))
To know your class name you can call something like this:
var className = NSStringFromClass(yourClass.classForCoder)