Saturday, December 21, 2024
HomeiOS Developmentios - WKWebview is nil although it's hooked to storyboard

ios – WKWebview is nil although it’s hooked to storyboard

[ad_1]

I’ve a WKWebview that’s if course hooked as much as the file by means of storyboard. You’ll be able to see it’s hooked on this image:

enter image description here

enter image description here

As you see each in storyboard and within the UIViewController file, the webView is hooked.

I get a zero from the webViewthe primary time I name it within the viewDidLoadon line 36.

enter image description here

That is the error:
Deadly error: Unexpectedly discovered nil whereas implicitly unwrapping an Non-compulsory worth

How can I get Xcode to acknowledge there’s a internet view??

EDIT
I load the VC like this:

let vc = joinFromInAppViewController()
vc.purchaseDate = purchaseDate
vc.purchaseEndDate = purchaseEndDate
vc.membershipPurchased = membershipPurchased
self.current(vc, animated: true, completion: nil)

The ViewController the place the webView is in:

import UIKit
import WebKit
import RevealingSplashView
import SwiftEntryKit

class joinFromInAppViewController: UIViewController, WKNavigationDelegate {
    
    @IBOutlet weak var webView: WKWebView!
    
    var purchaseDate: Int = 0
    var purchaseEndDate: Int = 0
    var membershipPurchased: String = ""
    
    let revealingSplash = RevealingSplashView(iconImage: #imageLiteral(resourceName: "RevealingSplashIconImage"), iconInitialSize: CGSize(width: 125, peak: 125), backgroundColor: UIColor(crimson: 225/255, inexperienced: 32/255, blue: 62/255, alpha: 1.0))
        
    var attributesShow = EKAttributes.bottomFloat
        
    let defaults = UserDefaults.commonplace
    
    override func viewDidLoad() {
        tremendous.viewDidLoad()
        
        view.addSubview(revealingSplash)
        revealingSplash.animationType = SplashAnimationType.heartBeat
        
        let myURL = URL(string: "https://www.google.com")
        let myRequest = URLRequest(url: myURL!)
        webView.navigationDelegate = self
        webView.load(myRequest)
        
        //revealingSplash.startAnimation()
        
    }
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments