Tag Archives: iOS

failable initialiser swift simple example

failable initialiser swift simple example In swift, Failable initialisers are used with structure,class and enumeration. When it is not sure that a property within class or structure or enumeration will be initialised then failable initialisers are used. For this, we write initialiser with init? syntax and if initialisation succeeds then value is assigned or else… Read More »

Closures in swift – what are closures ?

Closures in swift Closures are block of function code that can be written without name inside another function call. Just write code within braces {}


Variable argument functions swift

Variable argument functions swift We write the function in the similar way, just we need to take variable number of arguments runtime then we write function in the following way with argument list ending with three dots.


For-in loop in swift

For-in loop in swift You use for–in to iterate over items in a dictionary by providing a pair of names to use for each key-value pair. Dictionaries are an unordered collection, so their keys and values are iterated over in an arbitrary order.


Switch in swift programming

Switch in swift programming switch case in swift is not limited upto the integer tests only but it can also be used for variety of comparisons.


Optional in swift – what is optional ?

Optional in swift- what is optional in swift ? In swift, a variable either may contain a value or nothing (nil). Put “?” after the variable type. So, to declare such variable, following syntax is used :

Another way to handle optional values is to use the ?? operator


Clang – what is clang ?

The Clang Compiler is an open-source compiler for the C family of programming languages, aiming to be the best in class implementation of these languages. Clang builds on the LLVM optimizer and code generator, allowing it to provide high-quality optimization and code generation support for many targets.