Posts

Showing posts from June, 2015

Making an iOS app like making a Java web app - Part 2: writing iOS apps

Image
In part 1 , I gave a brief, very high level overview on how Java web apps are written. Ok how about a quick recap of what was covered in part 1...actually let's use some diagrams this time. Previously ... in Part 1 Java web app architecture The above diagram essentially summarises what was written in the section titled " Java web app walkthrough", so in a nutshell For a Java web app, the user interface (UI) is created via HTML/CSS/Javascript The Controllers i.e. Java code act as a communication layer between the UI and the Data store, typically a Database: what that means is that the Java code passes data to and from the UI and the Data Store(Database). The kind of Data Store that I normally work with is a  relational database , there is a reason I have mentioned the type of database, read on to find out why. Refer to Part 1 for a more detailed walkthrough of a real-world example of using a registration form Now how can we apply the above approach to w...

Making an iOS app like making a Java web app - Part 1: writing Java web apps

One of the outcomes of my work on my first iOS app is my Github repository Html5StarterAppWithSwift which is an Xcode project template for creating Html5/iOS apps, or maybe we can call it "native Html5 iOS apps"... hmm what do I mean? What I mean is, it's an Xcode project template, that can help you create native iOS apps such that all of the app's UI is powered by Html/Javascript, while it makes use of native iOS code ( Swift ) for scheduling local notifications, storing data ( Core Data ) etc. p.s. if you would like to know about Html5StarterAppWithSwift , you can have a read of this post . So what is this post about? I have a background in writing  Java  web apps i.e. for my day job, I write Java web apps using frameworks such as Struts , Play  etc and there is a way in which those Java web apps are written. Now, when I started working on my first iOS app, my Java developer background played a big part in the way I structured my app i.e. separation of code...

Building my first mobile app: the journey so far - Part 2: App inception

Image
In this post , I shed some light on the background and the circumstances leading upto my App( iOS ) and in this post, I will talk about when I first got the idea and for the App i.e. App Inception and my recovery. So for those who have not read part 1 of the series, basically what happened was, I am a Software engineer who lived a pretty good life, until one day I was a victim of a hit and run car accident. I was a pedestrian crossing the road, when a drunk driver ran a red light and hit me, left me for dead and ran away. I was eventually rescued by the paramedics and amongst other things, I suffered from a Traumatic brain injury and things fell apart. There is tragedy in my story, even though it's not quite like Okonkwo's story , it's tragedy none the less and my story is still going and good things are starting to happen. App inception So as I said, few months post injury, I had a break-up with my now ex-girlfriend, what that meant was that my family had to live...

Getting the dayBefore and dayAfter from NSDate (in Swift)

So before I write part 2 of the story of how my first mobile( iOS ) app came to be, this would be a small post on how to use Extensions in Swift, to make code more readable...amongst other things. Problem So in my iOS app, there are a few places where I have to get the day before(yesterday) and the day after(tomorrow) for a date.  Solution In the first version of my code, I had the code such as this (Read on to find out a more correct solution for calculating dates) For the day after let oneDay:Double = 60 * 60 * 24 return self.dateByAddingTimeInterval(oneDay) For the day before let oneDay:Double = 60 * 60 * 24 return self.dateByAddingTimeInterval(-(Double(oneDay))) one day has 24 hours, each hour has 60 mins and each minute has 60 seconds, so 60 * 60  * 24 to calculate the solution to my problem. This was working and it was all fine...until I delved deeper into Swift(by reading this  ebook  by Apple) and found out about Extensions!!! It ...