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

defer in Swift

defer is used to define the set of statements that should be executed just before the control leaves the current scope of execution. The statements defined in defer block are executed irrespective of how the execution control leaves the scope in which defer is defined. The statements defined in defer block are executed just before… Continue reading defer in Swift