Blog

Below you will find pages that utilize the term “Blog”
August 17, 2018
Pair and Triple in Kotlin

It is a very common use case where we want to return two values from a method, can be either of same data type or can be of different data types.

August 10, 2018
Native Android image sharing in Unity

In continuation to my previous blogs Native Android in Unity and Native Android text sharing in Unity, will consider another example of native Android screenshot sharing functionality in the unity app.

July 27, 2018
Extensions as Members : Kotlin

In continuation to my last Medium post Extensions in Kotlin where I explained what are Extensions and how do we use it, this medium post will cover the implementation of Extensions as members of some other class.

July 13, 2018
Companion object in Kotlin

Unlike Java or C#, Kotlin doesn’t have static members or member functions. Kotlin recommends to simply use package-level functions instead.

July 13, 2018
Computed Property in Swift

Object creation is a heavy process. When we create a class object, all the public and private properties of that class are initialised inside the constructor. Every variable inside a class initialisation requires a certain amount of time to allocate the memory on the heap and hold its reference on the stack. The more variables, the more time it may take but since the time is in microseconds or even less, it’s not observable.

June 29, 2018
Native Android text sharing in Unity

In continuation to my previous blogs Native Android in Unity, will consider another example of native Android text sharing functionality in the unity app. This is a very common requirement in any unity app targeting Android platform to share the high score or challenge other players with a text message or a screenshot of the high score. The sharing can be done via any of the app available on the user’s device which supports sharing.

June 22, 2018
Native Android in Unity

While developing unity games in C# targeting android platform, we always want to use few native android features in our game. These features can be showing notifications on certain actions in the game or can be sharing the high score with other players and inviting them to try our game using android native share. Android gives us all the possibilities to achieve these native android functionalities in unity app using C#.

June 15, 2018
The Nothing Type : Kotlin

What if I say there is a class called Nothing in Koltin.

And What does it do? Nothing.

The time I read about the class Nothing for the first time, it sounds interesting to me. This class has no instance and it is used to represent a value which never exists. This class is also used to represent a return type from a method that will never return.

June 8, 2018
Label Reference in Kotlin

Any expression in Kotlin may be marked with a label. This can be used to as an identifier. A label can be defined in Kotlin using label name followed by @ sign in front of any expression.

May 21, 2018
Tuple in Swift

It is a very common use case where we want to return two values from a method, can be either of same data type or can be of different data types.

March 3, 2018
Property, Getter and Setter : Kotlin

I started developing Android apps in Java where encapsulation of object-oriented programming was achieved through declaring variables as private fields with their getter and setter as public methods. The moment I converted my Java code to Kotlin, it replaced each variable along with its getter and setter with just a single line of code. Although I was amazed at how can a single line of code replace the complete variable with the same functionality, but later on understanding it, I started liking writing the code in Kotlin. Let’s understand how it works in Kotlin.

January 12, 2018
Kotlin ‘For’ loop

While converting all my java code to kotlin, one of the strange syntax change I observed was the for loop in both the languages. Later I realized in Kotlin, there are few concepts which are completely different from java or any other another language for loops.

January 11, 2018
when operator in Kotlin

when operator is a replacement of switch operator in other languages.

when operator matches its argument with all the branches until it matches with anyone, else it executes the else block.

November 24, 2017
‘in’ operator in Kotlin

‘in’ operator in Koltin is used to check the existence of particular variable or property in a Range or Collection whereas a ‘!in’ operator is just a not of ‘in’ operator and returns true if the condition is false. It can also be used to iterate over a range or collection.

November 23, 2017
TypeCheck (‘is’) and Cast (‘as’) in Kotlin

Type check is a way of checking the type(DataType) or Class of a particular instance or variable while runtime to separate the flow for different objects. In few languages, it’s also denoted as Run Time Type Identification (RTTI).

November 13, 2017
Safe calls(?.) vs Null checks(!!) in Kotlin

In Kotlin, the type system distinguishes between references that can hold null (nullable references) and those that can not (non-null references). For example, a normal property can’t hold a null value and will show a compile error.

November 10, 2017
lateinit Property in Kotlin

There can be two ways to declare and initialize a var property

var variable : CustomClass = CustomClass() 
 or
var variable : CustomClass? = null

The first property is initialized while declaration itself and doesn’t require a null check (?.) while using it.

November 7, 2017
Higher-order functions in Kotlin

What is a higher-order function?

In Kotlin, a function can be passed as a parameter or can be returned from a function, the function which does the same is known as a higher-order function. In other words, a higher-order function is a function that takes functions as parameters or returns a function.

August 5, 2017
Backing Field in Kotlin

What is Backing Field ?

Backing field is an autogenerated field for any property which can only be used inside the accessors(getter or setter) and will be present only if it uses the default implementation of at least one of the accessors, or if a custom accessor references it through the field identifier. This backing field is used to avoid the recursive call of an accessor which ultimately prevents the StackOverflowError.

1 2 3 4 5 6 Next