I am trying to create a WebView in a storyboard Swift 2.3 iOS application. However, whenever I navigate to the View with the WebView, the app crashes. I am posting the storyboard and code for the WebView. Does this give any indications as to what I am doing wrong?
Storyboard scene:
<!--WebView View-->
<scene sceneID="oin-Tm-kjC">
<objects>
<viewController title="WebView View" id="iti-7S-ISp" customClass="webViewViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="3bg-3D-Wcg"/>
<viewControllerLayoutGuide type="bottom" id="Mnm-nM-yzb"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="gnf-vw-fwi">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rVb-rt-chb">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="delegate" destination="iti-7S-ISp" id="E7m-JN-oGx"/>
</connections>
</webView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="webView" destination="rVb-rt-chb" id="ldC-1p-1XM"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Dj4-qu-aUe" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="248.80000000000001" y="-631.0344827586207"/>
</scene>
webViewViewController.swift:
import UIKit
class webViewViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!
let url = "https://www.google.com"
override func viewDidLoad() {
super.viewDidLoad()
let nsUrl = NSURL(string: url)
let nsUrlRequest = NSURLRequest(URL: nsUrl!)
webView.loadRequest(nsUrlRequest)
}
}
I see this line in the console: "Unknown class webViewViewController in Interface Builder file"
Followed by: "*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key webViewViewController.'".
Additionally, the app runs fine if I remove the coupling to the webViewViewController.swift. In which case it just shows an empty UIWebView.