Using ionic to build an iOS app using Swift

So I have an iOS app that i am writing with Swift. What i have done is created a bridge between the HTML5 web components and Swift so seamless communication takes place in between those. So are there any guides which i can follow that can guide me in incorporating ionic in my app without too much hassle. To be more specific, I have a web-view which loads files from the main bundle. So far, the way it is working is i have the main html file say index.html and all js files within the same folder for my webview to be able to load the html files and js resources. E.g. in my index.html file only something like this would work

<script src="jquery.js"></script>

and not

<script src="js/jquery.js"></script>

I tried to do that with a sample Ionic app and realised that it has far too many dependencies and it would be a lot more work to include them all in the same folder. I would be happy to have any guides? or even a sample project for xcode 6 beta using Swift, which has a webview that shows a sample ionic app. So i can get to know how to configure the webview with HTML resources, swiping gestures etc.

fyi, My Swift code loads the index.html file as follows

var path = NSBundle.mainBundle().pathForResource(“index”, ofType: “html”);

I know there is a inDirectory parameter in pathForResource called inDirectory, but i cannot get it do work.

Bhuman

Hi,

If you are after experimenting with Swift and getting ionic to work with your javascript/native binding, then I’m afraid i’m not much help.

What I would say is that a huge amount of Ionic is designed to work with Cordova/Phonegap. Cordova/Phonegap is essentially a web view with specific bindings to help with javascript/native calls.
From the huge list of plugins supported by cordova to the command line that ionic uses, its all a rather large ecosystem…
I don’t mean to dishearten you though
Perhaps try and get Cordova re-made in Swift?

:smiley:

So i think i already have Ionic and Swift working together. My question is that, i just want to be able to load both html and javascript in my webView without both of them being in the same folder. It may or may not be possible with Swift and that is why i have posted the question.

For those who are curious about how I solved this problem? well I have written about it in a blogpost,

And I have built and open-sourced a XCode html5 project template with Ionic framework. Below is a Github project link,

I have read you project,but I don’t know how to create swift app with ionic framework in xcode,can you tell me?

I have updated the post to provide more clarity on your question.