I mentioned in one of my previous posts, about how I thought the Ionic framework for building HTM5 apps was totally awesome. Well it is and the way I was trying to use it was to build a Hybrid iOS app. Ok, when I say hybrid, I mean the logic for the app is almost equally split between both native code and HTML5 code.

Why Hybrid app?

So the question is, without knowing any native iOS code, how did I come to the conclusion to build a hybrid app? Ok so apparently you can make a fully HTML5 app and use the Apache Cordova framework to build an iOS app without getting your hands dirty with native code, that sounds awesome! However, to me it was important to understand native code, just in the event that something goes wrong in the app and I need to fix it by tweaking native code, I am not completely clueless about how to go about fixing it. So in an attempt to know more about iOS internals, I started off by building simple native programs(apps?) using Swift with Xcode 6 beta at the time and I totally fell in love with Swift. It was at this time that I realised that in addition to Local Notifications, I could leverage one more feature that can come as a result of writing some native code; Core Data. So in my definition, I was no longer building an HTML5 app, I was building a “hybrid” app, that used both HTML5 and native code for the advantages it offered.

So what have I learned? 

So in addition to a whole bunch of useful things about developing for the iOS platform, I also learned that learning iOS development on your own can be a challenging task. In my case this was especially true, because more than learning how to build iOS apps, I was learning how to build iOS apps using Swift i.e. a new technology that has not been around for very long i.e. I started building my app sometime mid-2014. A good majority of the solutions out there for known iOS problems, use Objective-C and  since I lack(ed) Objective-C knowledge, it wasn’t/isn’t always easy to translate an Objective-C solution to Swift. Of course there exist, awesome developers like Jameson Quave that actually spend the time and effort to try and teach people by walking them through the various steps of building iOS apps. Ray Wanderlich also contains a comprehensive list if tutorials on iOS development with Swift.

So how am I trying to solve the problem I just mentioned?

Ok now that I have poured my heart out, I think it is time to stop procrastinating and get back on topic. So where was I? hmm….thats right, Ionic Rocks! So initially when I wanted to use Ionic framework for my app, I encountered a rather silly issue and at the time I did not bother solving it, because there was really no shortage of independent problems for me to solve. Anyway now that I have solved that rather simple problem that stopped me from using Ionic in my iOS app, I feel like I should share my knowledge and provide like an Xcode/Swift starter project that displays HTML content using the Ionic framework in a UIWebView. Please note, at this point, I am very well aware of the WKWebView, but since I am building something that works on iOS7 and upwards, I have decided to use the UIWebView.

You can fork the project from GitHub and if you think you can improve the project in anyway, please feel free to do so!

Just to be clear…

I received an email from someone asking me how to create an Ionic app with Swift. So to provide some more clarity, with this project you are creating a native iOS app. So what you will need is
  1. A machine that can run Xcode: at this time i.e. mid 2015, only Macs can run it
  2. Some familiarity with how to use Xcode: I would suggest give this tutorial a go! 
So in conclusion, if you are not familiar with Xcode once you create your first Xcode project to make an iOS app, you will be familiar with what I am talking about in this post. This GitHub repo is just an Xcode project template to help you get started on making your HTML5 iOS app.

Finally, I am working on My Day To-Do full-time right now so if you find my blog posts useful and want to support me you can buy the Pro version of My Day To-Do.


Leave a Reply

Your email address will not be published. Required fields are marked *