Skip to main content

Xcode starter project with the Ionic HTML5 framework using Swift

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.

Comments

Amrutha said…
Before we get into how to use XCode on Windows, we should first define XCode. So XCode is an Integrated Development Environment (IDE), which is essentially a very powerful piece of software used to create Mac apps. If you intend to design programmes for the Mac OS, you should be aware that XCode is an Apple-created toolset that will help you get there. Designing apps for Windows is a far more doable effort because you can accomplish it on any platform. However, if you want to create Apple applications, XCode is essential.
xcode in windows

Popular posts from this blog

Upload to AWS S3 from Java API

In this post, you will see code samples for how to upload a file to AWS S3 bucket from a Java Spring Boot app. The code you will see here is from one of my open-source repositories on Github, called document-sharing. Problem Let’s say you are building a document sharing app where you allow your users to upload the file to a public cloud solution. Now, let’s say you are building the API for your app with Spring Boot and you are using AWS S3 as your public cloud solution. How would you do that? This blog post contains the code that can help you achieve that. Read more below,  Upload to AWS S3 bucket from Java Spring Boot app - My Day To-Do (mydaytodo.com)

App update, discovering Protractor(testing) and an Angularjs State machine

So for the last couple of weeks, I have not be able to update my blog or finish a couple of the posts that I started writing. Well, I have...been a bit busy, with some the following things,  Testing my app I have been using the app( iOS ) on my iPhone for the past couple of months now, which is both good and bad. The good thing is I can test it and the bad thing is, I can use it every day. Part of the reason, I started building this app is to have something that I can and like to use everyday and since I am already using it, the incentive to release it is not as high as if it were something that I could not use. Anyway I did make some good progress over the last couple of weeks, like  Delete the app from my iPhone and do a clean install: this did help me find a few simple bugs that would pop-up when the app is first installed GET AN APP ICON, FINALLY! this was a bit of a hurdle and I thanks to Fiverr  and fivercrazyguy , I finally have my app icon. The day job ...

Why can't I cancel a local notification in my iOS app?(in Swift)

Prelude I have mentioned the fact that I am working on my first iOS app in a number of my previous posts and as such I face a number of newbie/noob(?) problems. They are not really problems as much as they are simply things that I do not know, for e.g. the following, how do I get the day of the week? where is my string.replaceAll in Swift? knowing which local notification brought my app to foreground ? serving HTML content in an iOS app that works on iOS 7 and above Thankfully, I have managed to make at least one generic solution and contribute it to the community i.e. my open-source Xcode project template( HTML5StarterAppWithSwift ) which you can get from Github . So this post basically describes another very simple problem that I have found a solution to, but I do not fully understand why the problem was occurring in the first place. Introduction As I have mentioned in this post , my iOS app uses local notifications i.e. UILocalNotification   and i...