I created a cocoa web browser. I added a NSSearchfield in my toolbar. I was testing it out then I got and Error saying Thread 1: Signal SIGART. In my debugger, it said
Could not cast value of type 'NSSplitViewController' (0x7fff8fbe20c8) to 'AppName.ViewController' (0x100049988).
This is happening because I linked the window controller to a split view controller instead of the viewcontroller. This is the code I got an error in
var viewController: ViewController {
get {
return self.window!.contentViewController! as! ViewController
// Error here
}
}
I have tried doing this
var SplitView: SplitViewContorller {
get {
return self.window!.contentViewController! as! SplitVC
// Error here
}
}
But then I get numerous errors saying
Value of type 'SplitVC' has no member 'webView'
In this code
var urlStr = searchFieldToolBar.stringValue
if urlStr.hasPrefix("https://") {
let url = NSURL(string: urlStr)
let req = NSURLRequest(url:url! as URL)
self.viewController.webView.load(req as URLRequest)
}
I don't know how to fix this.
Can you please help me