swiftwebui

How to keep LaunchScreen storyboard screen longer till WebUI loads


I am new to IOS app development. My requirement is to develop an app which shows an application on user login.

when users opens an app, Storyboard launch screen is displayed immediately and then a blank white screen is displayed after that login page is displayed for user login. I think WEbUI is taking time to load.

The problem here is the blank white screen which is getting displayed after launch screen. In order to avoid that I am trying to wait till web loads by having splash screen, But adding those functions are not working.Please let me know the solution with code.

Here is my code-- ViewController.swift

import UIKit

class ViewController: UIViewController {
     @IBOutlet weak var backgroundImageView: UIImageView!
     @IBOutlet var webView: UIWebView!
     override func viewDidLoad() {
         super.viewDidLoad()
       // Do any additional setup after loading the view, typically                 from a nib.
        let url = URL (string: "https://www.google.com");
    let requestObj = URLRequest(url: url!);
    webView.loadRequest(requestObj);
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
   } 
 }

Please let me know if there any other solution..


Solution

  • Make one extra controller that looks like your launch screen present it after launch screen but without animation so user can not see that you change screen white webview to load on this screen then present viewcontroller with webview

    I make test project for you You can download from: http://www.filedropper.com/testproject