Call Function from AppDelegate

If embedded in Navigation Controller:

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
if let rootViewController = window?.rootViewController as? UINavigationController {
    if let viewController = rootViewController.viewControllers.first as? ViewController {
        let url = alert["imgurl"] as? NSString
        viewController.loadImage(url as String)
    }
}
}

If not embedded in Navigation Controller:

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
    if let rootViewController = window?.rootViewController as? ViewController {
        rootViewController.loadImage()
    }
}