Rss Feed
  1. Generic Stack Implementation In Swift

    Thursday, July 10, 2014

    I'm pretty excited about this new feature in Swift; Generics. This is something borrowed from C++. The `Swift Programming Language` book stated "Generic Code enables you to write flexible, reusable functions and types that can work with any type, subject to requirements you define". Basically it just means you can write functions that can work with multiple types of parameters, collection types that can perform operations on the data set without any concerns of the type of the data set.

    Below is a Gist of Generic Stack Implementation in Swift, a Stack that can work with any data types.


    In the above snippet, you can see, <T> is the additions, right next to class name, that makes it a generic type. You can make use Type T within the implementation just like any other type.

    You can check the sample project here in Github.

  2. Property Initialisation in Swift

    Sunday, June 29, 2014

    This is a very simple post, briefing the different ways of Property Initialisation within a Class in Swift. Just a little of learning into Swift, you should have realised that every variable has to be either initialised with some value or with its type. Similar strategy holds for the Properties inside the class.

    Below are gists of various property initialisations.


    That's the basic of Class Property Initialisation in Swift. Try it out in Xcode Playground.

  3. Operator Overloading

    Monday, June 23, 2014

    One of my favourite feature of C++ has been now made available to iOS / Mac Developers in swift! Now you can overload any operator or combination of operators and thus be able to define a behaviour to implement when its used in an expression.

    Below is a piece of code that you can try out in Xcode's Playground

    With the addition of === operator, using == operator for comparing 2 reference type results in a compiler error, unless you overload it as shown above.

  4. Intro post

    Saturday, June 7, 2014

    So.. Big day June 2nd at WWDC14! Swift Language is going to replace Objective-C in iOS and Mac Development here after. None of the rumor makers saw that coming.. did they?

    Personally I am very excited about this. I had been with Objective-C for past 3 years and I don't like the thought of it fading off, but I believe is change is good! I'm hoping this change is going to make it better for us developer's.

    Initial look at the language shows some of the things made simpler and some complex. What I liked is that now the updated syntax brings it closer to scripting languages out there (Now many of the web developers have the opportunity to flock into iOS and Mac Development). Some of the syntax's have been made simpler and some complex (very complex!). Its definitely going to take some time for it to settle in.

    I had been writing blog posts from sometime now; some tech posts, some of open source softwares and photography. I always wanted to get into geek mode start writing programming posts. I think this is the right time for that. I hoping to post some interesting stuff on iOS Development that I come across in my professional life.

    Thanks you.
    Cheers