I\'ve just created a Single View Application project with ViewController class. I would like to show a UIAlertController from a function which is located inside my own class
If you want to create a separate class for displaying alert like this, subclass NSObject not UIViewController.
And pass the ViewControllers reference from which it is initiated, to the showAlert function so that you can present alert view there.