Tried to make first app in Xcode: took my Web App folder and tried to implement it to XCode project with WebView. But got no success - always blank screen in simulator...
I started new project, created WebView
and implement a folder with my Web App through File
-> Add files to "MyProject"
with option set to copy files and set url to local index.html
in view controller. What am I doing wrong?
Project Structure:
-dist
--index.html
--scriptsbundle.js
--img
---myimages.png
-MyProject
-MyProject.xcodeproj
-MyProjectTests
-MyProjectUITests
My ViewController.swift
:
import UIKit
class ViewController: UIViewController {
@IBOutlet var Webview: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL(string: Bundle.path(forResource: "index", ofType: "html", inDirectory:"../dist")!)
let request = NSURLRequest(url: url as! URL)
Webview.loadRequest(request as URLRequest)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}