GCD Sync Vs Async

Without wasting any time let me tell you the difference between sending executing block synchronously vs asynchronously in GCD Sending a block synchronously from a queue to another queue, blocks the sending queue until the block that is sent for synchronous execution gets completed. Sending a block asynchronously does not block the sending queue. In… Continue reading GCD Sync Vs Async

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

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

guard In Swift

guard keyword, as the name suggests, guards the execution in Swift. Either you meet the condition, or just get out of here. The syntax for guard goes like this If you know swift you would be knowing that the condition here should be Bool. The else clause is compulsory with guard. If the condition in… Continue reading guard In Swift