This is my project structure:
I have 2 different View Controllers (GameViewController,
TaskViewController
). Both of them should be able to show a web view
to the user.
The web view for GameViewController should load the file
www/game/index.html
The web view for TaskViewController should load the file
www/task/index.html
Adding the web view is quiet easy. But how can I specific the right path?
This was what I've tried inside the GameViewController
:
let url = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "www/game") // not working
let url = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "game") // not working
let url = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "myApplication/www/game") // not working
How can I set the path for the files (with the same names [index.html
] ) the right way?
Any help would be very appreciated. Thanks.