Posts

Showing posts from February, 2015

Branching in Git: simplified with examples

Image
Distributed version control systems are a lot of fun to work with, and I just happen to know  Git  more than any of the others. I do know Mercurial but while I had to learn Mercurial on my own, I had(still have when I get stuck) a great teacher for Git. He's the guy who created SuburbChooser , he could probably describe SuburbChooser's purpose better than me. All I know is that it is built to help people  and it is powered by some pretty complex algorithms under the hood.  Anyway let's not lose focus, we are here to talk about why branching in Git is awesome and how can we benefit from it in our projects. Why this post? I am building a dieting app with this researcher who does research in, well; health and exercise? or so (I do not know the exact research topic). What I know is that she is an expert in this field and besides sounding smart when talking,  she has published research in the field to back up the smart talk. Anyway, so while...

Local notifications in an Html5 powered iOS app(native)

Image
Ok, so I have already written about why I decided to take the route of building an hybrid(Html5/Native) app, such that I get to know the native environment. So that post also mentions how I have built this Xcode starter project which can serve as a template for building html5 iOS apps using the Ionic framework.   Recently, I wrote about about how that initiative of mine helped someone . and what I have done now is created a branch, Notifications  which provides some sample code for adding local notifications to the project. In this post, I am going to talk about what is in the Notifications branch. Questions 1) Why build a Hybrid app such that I need to write some native code? Well one of the reasons outlined in my previous post , was that I wanted my app to use local notifications.   2) But scheduling local notifications is so simple, why add some sample code for it? Yes scheduling local notifications is simple and this tutorial does a good job of showing ho...

How do I get the day of the week for a date in my iOS app (using Swift)?

The title of this blog can be continued with the following line "...such that it works on both iOS7.1 and iOS8 and above". For a certain feature of my app, I needed to find out what day of the week it is for a give date and a lazy Google search lead me to the following code let today = NSDate () let calendar = NSCalendar ( calendarIdentifier : NSGregorianCalendar )! var components : Int = calendar . component (. WeekdayCalendarUnit , fromDate : today ) So I included that code in my app and first tested it on my iPhone 6 and it was working great, I was like "phew! one more thing done for my app". Unfortunately, that expression was a bit premature and I realised that when the app crashed after I deployed it to my old iPhone 5 running iOS7.1. This is the error I got, [_NSCopyOnWriteCalendarWrapper component:fromDate:]: unrecognized selector sent to instance 0x7f8452f4e490 Well as it turns out, the method that includes the fromDate parameter, ...