Hello, I've been searching all over for this for days and I can't find the solution as I'm kind of illiterate with code so I have been reading and watching tutorials. Anyway, I have a webapp I created that is in HTML, CSS, and javascript. I have all the local files as I want it built-in to my xcode project. I am having trouble getting the code to work and this is what I have in the ViewController.swift All I am trying to do it make a simple app that can interact with my javascript using WKWebview tool.
This is what i have came up with and tried several things but no matter what I get a "SIGABRT" error. I think I am not telling it correctly where my files are located? Can someone please help? I have searched all over the web and apple documentation but since I don't know the code I don't really understand the language of what I am doing wrong. I tried looking at all the sub link apple documention and it shows you what to use but not really how to use it. So I feel like I am using it wrong...
import UIKit
import WebKit
class ViewController: UIViewController {
@IBOutlet weak var loadhtml: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let webView = WKWebView()
let htmlPath = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "www")
let htmlUrl = URL(fileURLWithPath: htmlPath!)
let request = URLRequest(url: htmlUrl)
loadhtml.load(request)
webView.loadFileURL(htmlUrl, allowingReadAccessTo: htmlUrl)
view = webView
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
// Do any additional setup after loading the view.
}
I have a "www" folder I added to the main file that has the index.html file in it along with a javascript file and also subolders with the images, CSS, etc..
I am getting frustrated trying to fix it.
Thank you in advance...