Custom Types As Raw Value for Enum in Swift

From Apple language guide : Raw values can be strings, characters, or any of the integer or floating-point number types. Each raw value must be unique within its enumeration declaration. After reading these lines from Apple many people remain under impression that custom types cannot be used as Raw values for enums in Swift. Actually… Continue reading Custom Types As Raw Value for Enum in Swift

Ways to Unwrap Optionals in Swift

In this post I will explain all the possible ways to unwrap an optional in Swift. Lets look at them one by one with their uses and consequences of using them Force Unwrapping This is the easiest way to unwrap an optional and that’s why tempting. You need to just put exclamation mark (!) after… Continue reading Ways to Unwrap Optionals in Swift

Completion Handler in Swift

When you are new to Swift, and you see completion handlers, these are the most mysterious guys around. You might have found it difficult to get grasp on it. Don’t worry we will demystify them in this article. I will explain to you what are they, why are they there and how they operate. After… Continue reading Completion Handler in Swift

Delegate in Swift

Delegation is a design pattern that enables a class or structure to hand off (or delegate) some of its responsibilities to an instance of another type. Conversely speaking Delegate is nothing but a class/structure that does some work for another class or structure. Advantages of using Delegate Delegate helps in keeping Class/Struct clean. Class can… Continue reading Delegate in Swift

Class Vs Struct in Swift

In this article we will go through the differences between Class and Struct in Swift. We will consider all the differences but will take a deep dive into the main difference. i.e. The Class is reference type whereas Struct is value type in Swift. By this I mean that the Class instances are hold as… Continue reading Class Vs Struct in Swift