Well you just need to find the topmost view controller and present the alertcontroller
from there.
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;while (topController.presentedViewController) { topController = topController.presentedViewController;}[topController presentViewController:alertController animated:YES completion:nil];
Note: This is objective-c version of the code. Kindly convert it to swift accordingly.
SWIFT
let topController = UIApplication.sharedApplication().keyWindow!.rootViewController as UIViewControllerwhile (topController.presentedViewController) { topController = topController.presentedViewController;}topController.presentViewController(alertController, animated:true, completion:nil)